我遇到openFileOutput方法http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String,int)
的问题提到的文档:“如果文件尚不存在,则创建文件”
我收到了这个错误:
System.err java.io.FileNotFoundException: /data/data/****/files/conf.properties: open failed: ENOENT (No such file or directory)
System.err at libcore.io.IoBridge.open(IoBridge.java:406)
System.err at java.io.FileInputStream.<init>(FileInputStream.java:78)
System.err at android.app.ContextImpl.openFileInput(ContextImpl.java:642)
System.err at android.content.ContextWrapper.openFileInput(ContextWrapper.java:159)
System.err at com.ecab.file.ManageText.getString(ManageText.java:25)
System.err at com.ecab.ConnectionActivity.initTexts(ConnectionActivity.java:67)
System.err at com.ecab.ConnectionActivity.setAfterViews(ConnectionActivity.java:61)
System.err at com.ecab.ConnectionActivity_.afterSetContentView_(ConnectionActivity_.java:105)
System.err at com.ecab.ConnectionActivity_.setContentView(ConnectionActivity_.java:111)
System.err at com.ecab.ConnectionActivity_.onCreate(ConnectionActivity_.java:32)
System.err at android.app.Activity.performCreate(Activity.java:4465)
System.err at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
System.err at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2033)
System.err at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
System.err at android.app.ActivityThread.access$600(ActivityThread.java:132)
System.err at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1157)
System.err at android.os.Handler.dispatchMessage(Handler.java:99)
System.err at android.os.Looper.loop(Looper.java:137)
System.err at android.app.ActivityThread.main(ActivityThread.java:4575)
System.err at java.lang.reflect.Method.invokeNative(Native Method)
System.err at java.lang.reflect.Method.invoke(Method.java:511)
System.err at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
System.err at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
System.err at dalvik.system.NativeStart.main(Native Method)
System.err Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
System.err at libcore.io.Posix.open(Native Method)
System.err at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
System.err at libcore.io.IoBridge.open(IoBridge.java:390)
System.err ... 23 more
我在这里找到了类似的帖子:openFileOutput FileNotFoundException但是没有理由解释这个问题。所以我的问题是为什么我的文件不存在而没有创建?