Skip to main content

Exiting midlet in lwuit - and still calling notify destoryed

4 replies [Last post]
68060
Offline
Joined: 2011-08-29
Points: 0

Hi,

does this:

Display.getInstance().exitApplication();

call notifydestroyed and destoryapp? it doesnt appear to ? Or it might be an emulator bug... (wtk 2.5.2) - but if i quit the emulator it definitely calls them methods?

I want to register an alarm for the push registry to reopen my app and I need to do this in the MainMIDlet class (or push registry wont work it seems) but I can get access to it to directly call these methods, so im kind of stuck. How do I get them to call? I have a button in my app that quits the app but only does so by using Display.getInstance().exitApplication(); - thus im really not sure *how* to make notifydestroted and destroyapp to get called to register my push stuff.. When I try to access MainMIDlet to staticly get at things like:

MainMIDlet.myInstanc the compiler confusingly tells me MainMIDlet does not exist..

thanks,

Gaz.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
68060
Offline
Joined: 2011-08-29
Points: 0

Actually found a work around - I can do pushRegistry stuff from statemachine so logn as I explicitly give it "userclasses.MainMIDlet" instead of using this.getClass().getName()

Still seems a little odd that Display.getInstance().exitApplication(); wont call destroyApp or notifyDestroyed, or maybe im thinking in the wrong terms..

68060
Offline
Joined: 2011-08-29
Points: 0

Actually the push registry registers with no error but it doesnt seem to launch, my testbed app works fine but i do it all in the actual midlet class... so im still suck it seems i really need to do this in destroyApp (or in midlet) to get it to actually work..

OR maybe the problem is that exitApplication in lwuit doesnt really exit application? im wrtk emu atleast i still see things happening even though the screen vanishes and goes back to the icon screen - my thread which shows me the time every minute for instance is still going, and even my timertasks.. i figured exitApplication would close all of this and truely exit??

68060
Offline
Joined: 2011-08-29
Points: 0

In short, how do I import userclasses.MainMIDlet; ? its needed at times..

I know I can pass a midlet over as a gernic midlet but not a MainMIDlet, i did this by adjusting statemachine constructor which helps for the methods in the superclass thankfully.

vprise
Offline
Joined: 2003-11-07
Points: 0

destroyApp is called otherwise the MIDlet wouldn't exit. The MIDP spec says that notifyDestroyed() shouldn't be invoked when destroyApp is invoked explicitly, only when the user destroyed the app in some other way.

If you need a variable during construction initialize it by fetching it in your initVars() method.