On Fri, May 27, 2011 at 10:31 AM, Marco <net...@lavabit.com> wrote: > On 2011-05-27 Mark Murphy <mmur...@commonsware.com> 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 the constructor and expect them to work. http://developer.android.com/guide/topics/fundamentals/activities.html > 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 MainActivity. -- 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 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