[android-developers] Do static variables of an ApplicationContext subclass left untouched when the process is killed?

2010-09-07 Thread Agus
Do static variables of an ApplicationContext subclass left untouched
when the process is killed?

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


Re: [android-developers] Do static variables of an ApplicationContext subclass left untouched when the process is killed?

2010-09-07 Thread Mark Murphy
On Tue, Sep 7, 2010 at 10:37 AM, Agus agus.sant...@gmail.com wrote:
 Do static variables of an ApplicationContext subclass left untouched
 when the process is killed?

When the process is killed, the Dalvik VM is also destroyed, and so
all static data members or other objects are purged from the device.

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

Android Training in London: http://skillsmatter.com/go/os-mobile-server

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


Re: [android-developers] Do static variables of an ApplicationContext subclass left untouched when the process is killed?

2010-09-07 Thread Agus
Thanks for the prompt reply Mark.

If a Service is not running in the same process as the
ApplicationContext, then the system will not try hard to keep the main
process running (ApplicationContext) under low memory?

Does the Service's onDestroy get called prior to the
ApplicationContext's onTerminate() method?

On Tue, Sep 7, 2010 at 7:49 AM, Mark Murphy mmur...@commonsware.com wrote:
 On Tue, Sep 7, 2010 at 10:37 AM, Agus agus.sant...@gmail.com wrote:
 Do static variables of an ApplicationContext subclass left untouched
 when the process is killed?

 When the process is killed, the Dalvik VM is also destroyed, and so
 all static data members or other objects are purged from the device.

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

 Android Training in London: http://skillsmatter.com/go/os-mobile-server

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

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


Re: [android-developers] Do static variables of an ApplicationContext subclass left untouched when the process is killed?

2010-09-07 Thread Mark Murphy
On Tue, Sep 7, 2010 at 11:19 AM, Agus agus.sant...@gmail.com wrote:
 If a Service is not running in the same process as the
 ApplicationContext, then the system will not try hard to keep the main
 process running (ApplicationContext) under low memory?

Each process has its own Application object. Unless you have really
really really good reasons for it, do not run your service in a
separate process, please.

There is no ApplicationContext class in Android.

 Does the Service's onDestroy get called prior to the
 ApplicationContext's onTerminate() method?

If something stops the service, yes. If Android kills the process, no.
Having services linger in memory for no good reason is a quick path to
one-star ratings on the Market, so hopefully you are promptly shutting
down your services.

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

Android Training in London: http://skillsmatter.com/go/os-mobile-server

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