bitrazor.com ...THE source for mediocre content                                      

TiVo HME How-To: Get/Set Session State Info             

Often you'll want to store a piece of information so another part of your application can retrieve it, or you can remember a value from one run of the application to another.  To do this, use setSessionValue() and getSessionValue().  Example:

getBApp().context.setSessionValue("myZip", "98607");

This key/value pair gets written to the disk, so it'll persist across runs of your application.  Here's how to read it back:

System.out.println("My ZIP: " +getBApp().context.getSessionValue("myZip", "not found"));

The "not found" parameter is what getSessionValue returns if it can't find your key.

I've seen some hint in the forums that these session values are distinct if you have multiple instances of your application running, but I can't easily verify that. 

For more information, see "Application.Context" in the Javadoc included with the HME SDK.

                                                         Last updated: February 19, 2007