• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

destroyApp(true) || notifyDestroyed()

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok.where is the situation so that we have to compulsory use "destroyApp(false)" methode?

thanks for reply
rakesh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic