09-23-2012 08:33 AM
I have created an application which runs at auto-startup and extends 'Application' class. In that application by 'set alternate entry point', i started UI application by passing 'gui' arguments.
Now I have used static variables for instantiate and execute 'timer task' in that 'Application' class and want to cancel timer in UI application.
But by accessing static variable in UI class, I get null that staic variable.
I need to start timer at auto-startup in 'Application' class. So can anyone please guide me , how can i access static variable in UI class.
(static variable object is created in MyApplication class which extends Application
like- public static TimerDemo timer =new TimerDemo();
In UI class which is started from UiApplication, I used like- MyApplication.timer , returns null
Thanks in advance
09-23-2012 02:45 PM - edited 09-23-2012 02:48 PM
You can not access static values from different applications.
If you wish to share variables, put these in RuntimeStore. Here is a useful KB article to help doing this.
Be aware that RuntimeStore is not lost when an Application terminates. So I recommend that you clear references in RuntimeStore whenever you can to make sure that the garbage collector can free redundant Objects.
Note that an application that has two entry points is really two applications, so the two entry points do not share static variables.