> 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.).
Where do I have to call startActivity()?
It's not unlikely that I make something conceptually wrong
in my application, since I'm new to android.
This is what I did:
/*********************************************/
// MainActivity.java
public class MainActivity extends Activity {
public MainActivity() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
// getFilesDir() works here
AnotherClass myA = new AnotherClassImpl();
myA.start();
}
}
// AnotherClassImpl.java
public class AnotherClassImpl implements AnotherClass {
public AnotherClassImpl () {
ProblematicClass props = ProblematicClass.getProperties();
}
// ProblematicClass.java
public class ProblematicClass extends Activity {
private static ProblematicClass myProblematicClass = null;
public static ProblematicClass getProperties(){
if(myProblematicClass == null) {
myProblematicClass = new ProblematicClass();
}
return myProblematicClass;
}
public MediaSenseProperties() {
// getFilesDir() failes here
}
}
/*********************************************/
I hope this illustrates my method. All this should take
place in the same activity.
Marco
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment