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 destroyed, etc.).
On Fri, May 27, 2011 at 8:00 AM, Marco <[email protected]> wrote: > Dear list, > > calling getFilesDir() in my main activity works as > expected, but if I call it later from another class it > throws a NullPointerException: > > D/AndroidRuntime( 716): Shutting down VM > W/dalvikvm( 716): threadid=1: thread exiting with > uncaught exception (group=0x40015560) > E/AndroidRuntime( 716): FATAL EXCEPTION: main > E/AndroidRuntime( 716): java.lang.RuntimeException: > Unable to start activity > ComponentInfo{se.miun.application/se.miun.application.MainActivity}: > java.lang.NullPointerException > > What could be the reason and how to fix this? (The > problematic class extends Activity). Please tell me if I > should provide more information. > > Marco > > > -- > 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/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- 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

