• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

destroyApp(true) || notifyDestroyed()

 
Krisp Sigh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiii,
what difference will it make if
1)We end our application by calling notifyDestroyed()only and not call desroyApp(true)
2)or only call destroyApp(true).
3)or call notifyDestroyed() and destroyApp(true) as well.

What is the best way to terminate our Application?


Regards
krisp
 
Ramender Mall
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try THIS link.

It is important to understand the relationship between the destroyApp( ) and notifyDestroyed( ) methods and when they are used:

1. When the MIDlet is being destroyed by the platform, most likely because the user has requested it, the MIDlet's destroyApp( ) method is called with the argument true, and the MIDlet is destroyed when this method completes. It is not necessary in this case for the MIDlet to invoke its notifyDestroyed( ) method.

2. When the MIDlet itself wants to terminate, typically because it has no more useful work to do or the user has pressed an Exit button, it can do so by invoking its notifyDestroyed( ) method, which tells the platform that it should be destroyed. In this case, the platform does not call the MIDlet's destroyApp( ) method; it assumes that the MIDlet is already prepared to be terminated. Most MIDlets invoke their own destroyApp( ) method to perform the usual tidy up before calling notifyDestroyed( ), as shown earlier



- Ramy..
 
fred rosenberger
lowercase baba
Bartender
Posts: 12266
36
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Krisp",

You apparently missed our Naming Policy on the way in. We require a real sounding first AND last name. Please re-read the policy, and update your display name here.

thanks
 
Eduardo Marques
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In short:

- the MIDlet should never call its own destroyApp() method
it is the system's job to do so when the MIDlet is stopped
by the system

- if the MIDlet wishes to terminate by its own will it must call
notifyDestroyed()

- Before calling notifyDestroyed() the same clean-up actions
as done in destroyApp() should be performed. The system will
not call destroyApp() after notifyDestroyed().

I provide a skeleton implementation below to illustrate this.

 
madan singh
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Krisp,

desroyApp(true) call from your application, to terminate the application.
Where as notifyDestroyed() call by AMS(Application Managament software(i.e by your system)) which used to inform your appliaction that your application is going to terminate.

Bye
 
Krisp Sigh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks Ramender for providing me with the useful link.
Thanks Eduardo u cleared my all confusion that i was having.

Am clear with the concepts now.

Thanks
Regards
Krisp
 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok. what is the use of "destroyApp(false);" ?

thnks
rakesh
 
Krisp Sigh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Read this link

its given with example.

regards
Krisp
 
Rakesh Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.where is the situation so that we have to compulsory use "destroyApp(false)" methode?

thanks for reply
rakesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic