On Tue, Jan 24, 2012 at 2:16 AM, Zsolt Vasvari <[email protected]> wrote:
> In a Service...   Actually, it's WakefulIntentService, extending your
> class.
>
> I only got a single report of this failure (I use ACRA) and it's in a
> commonly executed code.

That's pretty bizarre. A fair amount of work will have been done
already in the Service before doWakefulWork() gets called. Moreover,
*I* use getApplicationContext() along the way, though by that point I
will have only called it on the Context passed into onReceive(), not
on the WakefulIntentService itself.

That being said, calling getResources() on the Application object
would worry me some in general. We have seen, over the years, that
Application and GUI-related stuff do not work well together, and I've
often wondered if that is somehow tied to resource access.

Is there a particular reason why you are calling
getApplicationContext().getResources(), rather than just
getResources()? getResources() is available on Service as well.

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

Android Training in DC: 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 [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