我的意思是我想在手机内存而不是 sdcard 上定义文件路径。
我想用这个:
FileOutputStream out3 = new FileOutputStream(Environment.getRootDirectory()+"/a/b.txt");
这给出了错误。
我怎样才能解决这个问题?谢谢。
错误
09-26 19:49:11.050: E/AndroidRuntime(20214): FATAL EXCEPTION: main
09-26 19:49:11.050: E/AndroidRuntime(20214): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.kelime.tekerrur/com.example.kelime.tekerrur.MainActivity}: java.lang.NullPointerException
09-26 19:49:11.050: E/AndroidRuntime(20214): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
09-26 19:49:11.050: E/AndroidRuntime(20214): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
09-26 19:49:11.050: E/AndroidRuntime(20214): at android.app.ActivityThread.access$600(ActivityThread.java:127)
09-26 19:49:11.050: E/AndroidRuntime(20214): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
09-26 19:49:11.050: E/AndroidRuntime(20214): at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 19:49:11.050: E/AndroidRuntime(20214): at android.os.Looper.loop(Looper.java:137)