Why not create a parentcontext and use this context for calling
getApplicationcontext().

like

Context parentcontext;

parentcontext = this; //must be the contrustor, pass the calling context
here.


and try using parentcontext.getApplicationcontext();

-- 
Warm Regards,
*Mukesh Kumar*,
Android Consultant/Freelancer,
India,Hyderabad.


On Tue, Jan 24, 2012 at 12:49 PM, Zsolt Vasvari <[email protected]> wrote:

> To ellaborate, it's inside the doWakefulWork() method.
>
> On Jan 24, 3:16 pm, 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.
> >
> > On Jan 24, 8:34 am, Mark Murphy <[email protected]> wrote:
> >
> >
> >
> > > Where are you executing this statement?
> >
> > > On Mon, Jan 23, 2012 at 6:41 PM, Zsolt Vasvari <[email protected]>
> wrote:
> > > > Has anybody seen this happen?
> >
> > > > I have the following line in my code:
> >
> > > > XmlResourceParser xml =
> > > >
> getAppplicationContext().getResources().getXml(R.xml.database_tables);
> >
> > > > Somebody reported a NPE on that line, so it can either be
> > > > getAppplicationContext() or getResources() returning a null.   The
> > > > same line works for countless other users.
> >
> > > > Anybody has any clues?
> >
> > > > --
> > > > 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
> >
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
> >
> > > Android App Developer Books:http://commonsware.com/books-Hide quoted
> text -
> >
> > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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
>

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