Oh, I see where you're going. Yeah, that should be OK. I've often
wondered why they didn't bother with a static getter on Application
itself, if the thing is going to live as long as a static.

On Mon, Mar 28, 2011 at 10:10 AM, Kostya Vasilyev <kmans...@gmail.com> wrote:
> 28.03.2011 17:59, Jake Colman пишет:
>>
>> Does extending the Application class to save the context and providing a
>> static method to access that context an appropriate solution as well?
>
> I don't see any problems with:
>
> class JakesApplication extends Application /* indirectly extends Context */
> {
>
> @Override
> public void onCreate() {
> super.onCreate();
> gInstance = this;
> }
>
> public static JakesApplication getInstance() {
> return gInstance;
> }
>
> private JakesApplication gInstance;
> }
>
> --
> Kostya Vasilyev -- http://kmansoft.wordpress.com
>
> --
> 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
>



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

Android Training in NYC: http://marakana.com/training/android/

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