[android-developers] Re: getFilesDir() throws NullPointerException

2011-05-28 Thread Marco
> > How to get access to these methods correctly? > > Move the code from ProblematicClass into MainActivity. > Or, if you are careful, you can pass your instance > of MainActivity to ProblematicClass. Or, if you are > careful, you can make ProblematicClass an inner class of > MainActiv

Re: [android-developers] Re: getFilesDir() throws NullPointerException

2011-05-27 Thread Mark Murphy
On Fri, May 27, 2011 at 10:31 AM, Marco wrote: > On 2011-05-27 Mark Murphy wrote: > >> ProblematicClass should not extend Activity. > > Then methods like getFileDir(), openFileInput(), … are not > defined. That's the reason why I extended Activity. You cannot create new Activity instances via th

[android-developers] Re: getFilesDir() throws NullPointerException

2011-05-27 Thread Marco
On 2011-05-27 Mark Murphy wrote: > ProblematicClass should not extend Activity. Then methods like getFileDir(), openFileInput(), … are not defined. That's the reason why I extended Activity. How to get access to these methods correctly? Marco -- You received this message because you are subs

Re: [android-developers] Re: getFilesDir() throws NullPointerException

2011-05-27 Thread Mark Murphy
ProblematicClass should not extend Activity. On Fri, May 27, 2011 at 9:10 AM, Marco wrote: > Thanks for the very fast response. > >> The  only reason  I can  think of  for getFilesDir()  to >> return null is if it's not a real live Activity instance >> (you created it via new MyActivity() instead

[android-developers] Re: getFilesDir() throws NullPointerException

2011-05-27 Thread Marco
Thanks for the very fast response. > The only reason I can think of for getFilesDir() to > return null is if it's not a real live Activity instance > (you created it via new MyActivity() instead of starting > it with startActivity(), you call getFilesDir() sometime > after the activity is des