On Tue, Aug 31, 2010 at 5:57 PM, DanH <[email protected]> wrote:
> Static variables are created and initialized when the class containing
> them is loaded into the VM by the class loader.  When the class is
> unloaded or the VM ended, the static variables go "poof".  There is
> generally no need to clear them.
>
> I suppose if you wanted to you could clear them in an onTerminate()
> method (in the application) or an onDestroy() method (in an activity),
> but there isn't much point in doing so, and there's no guarantee that
> either of those two methods will be called.

Do not rely on onTerminate() being called at all out of an emulated environment.

> If you're for some reason paranoid about the variables not being
> cleared when created (a serious violation of the VM's "contract"), you
> could clear them in an onCreate() method.
>
> On Aug 31, 12:24 pm, siva <[email protected]> wrote:
>> Hi Friends,
>>
>> I have used some static variable in my application, i want to clear
>> static variable value when will i close my application.anybody know
>> please give solution for that

-- 
"The flames are all long gone, but the pain lingers on"

-- 
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

Reply via email to