There are several alternatives listed at
http://developer.android.com/guide/appendix/faq/framework.html#3

I like to maintain global state in a subclass of
android.app.Application.

I share your concerns about static variables, particularly in Android
because the process classloader may outlive any of its activities or
services.

On Aug 31, 10:59 am, siva <sivaraj.r...@gmail.com> wrote:
> Thanks for reply,no chance to clear static variable?what alternative
> solutions for that
>
> On Aug 31, 10:50 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
>
>
> > On Tue, Aug 31, 2010 at 1:46 PM, siva <sivaraj.r...@gmail.com> wrote:
> > > Thanks ,can u explain,i am fresher in android,i want to clear static
> > > variable value,please give solutions
>
> > Delete the static data members. Then you do not have to clear them.
> > Mutable static data members have been considered an anti-pattern in
> > Java for a decade or so.
>
> > Rather than worrying about clearing the data members, worry about
> > where the data really should live. Does it belong in a database?
> > Should it be managed by a Service? Do you want a subclass of
> > Application? Etc.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android Development Wiki:http://wiki.andmob.org

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

Reply via email to