lordjoe wrote:
> I am making some temporary files on the android and need want to call
> deleteOnExit to help guarantee proper cleanup. This call will clean up
> when the JVM exits. It dawned on me that I do not understand the
> Application life cycle.
> 1) Does each application run in a separate JVM?

Generally, yes.

> 2) When does an Application's JVM exit - assuming there is one JVM per
> application.

That is unclear and definitely varies. For example, the process may be
terminated quickly enough that the JVM does not go through a normal
shutdown procedure. In other words, I would not rely upon deleteOnExit.

> 3) Can a JVM exit when the application is running but being suspended
> by the OS?

Yes, because there isn't really a "running but being suspended" notion,
at least as I think of the terms.

It is much simpler to not think of you having an "application", so much
as you having a basket of components (activities, services, etc.). Those
components may come and go, and Android handles all the issues
surrounding processes and JVMs behind the scenes. Part of the way
Android handles that, though, may result in behavior very different than
your traditional desktop JavaSE application.

Hence, again, I wouldn't rely upon deleteOnExit.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in US: 14-18 June 2010: http://bignerdranch.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to