I think it's more accurate to say *you may choose* to maintain global state
by extending Application.
It's my preferred approach, though it's important to to instantiate global
state lazily wherever it's sensible to do so.

I describe my default approach here:

http://blog.tomgibara.com/post/126377651/global-application-state-in-android

2009/9/11 Android Development <indodr...@gmail.com>

> Hello,
> The docs here:
> http://developer.android.com/reference/android/app/Application.html say
> that, if the application needs to maintain global state, it should do it
> here.
>
> Suppose, i need to load some configurable data from a config file (to be
> used later at runtime by my application's various components). This data
> will be valid throughout the application's lifecycle (until it dies).
>
> So, is it the best approach to extend this class and override the onCreate
> ( ) method to load config data from a data source ?
>
> Thanks in advance..
>
>
> >
>

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