Я продолжаю получать FileNotFoundException / IOException,
File directory = new File(Environment.getExternalStorageDirectory()
.toString()
+ "/Android/data/<package>");
if (!directory.exists()) {
boolean x = directory.mkdirs();
Log.d(TAG, "directory: " + x);
}
File path = new File(directory.getPath() , uri.getEncodedPath());
int imode = 0;
if (mode.contains("w")) {
imode |= ParcelFileDescriptor.MODE_READ_WRITE;
if (!path.exists()) {
try {
path.createNewFile();
} catch (IOException e) {
e.printStackTrace();
Log.d(TAG, "Error " + e.getMessage());
}
}
}
if (mode.contains("r"))
imode |= ParcelFileDescriptor.MODE_READ_ONLY;
if (mode.contains("+"))
imode |= ParcelFileDescriptor.MODE_APPEND;
return ParcelFileDescriptor.open(path, imode);
Исключение составляет
10-12 15:01:10.360: WARN/System.err(18679): java.io.IOException: No such file or directory
10-12 15: 01: 10.360: WARN / System.err (18679): в java.io.File.createNewFileImpl (собственный метод)
10-12 15: 01: 10.360: WARN / System.err (18679): в java.io.File.createNewFile (File.java:1115)
10-12 15: 01: 10.360: WARN / System.err (18679): на com.hair.android.camera.ImageContentProvider.openFile (ImageContentProvider.java:230)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.content.ContentProvider.openAssetFile (ContentProvider.java:726)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.content.ContentProvider $ Transport.openAssetFile (ContentProvider.java:247)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.content.ContentResolver.openAssetFileDescriptor (ContentResolver.java:534)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.content.ContentResolver.openOutputStream (ContentResolver.java:402)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.content.ContentResolver.openOutputStream (ContentResolver.java:378)
10-12 15: 01: 10.360: WARN / System.err (18679): на com.hair.android.HairAppActivity.onActivityResult (HairAppActivity.java:428)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.app.Activity.dispatchActivityResult (Activity.java:4541)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.app.ActivityThread.deliverResults (ActivityThread.java:2740)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.app.ActivityThread.handleSendResult (ActivityThread.java:2787)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.app.ActivityThread.access $ 2000 (ActivityThread.java:122)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1032)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.os.Handler.dispatchMessage (Handler.java:99)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.os.Looper.loop (Looper.java:132)
10-12 15: 01: 10.360: WARN / System.err (18679): на android.app.ActivityThread.main (ActivityThread.java:4025)
10-12 15: 01: 10.360: WARN / System.err (18679): по адресу java.lang.reflect.Method.invokeNative (собственный метод)
10-12 15: 01: 10.360: WARN / System.err (18679): в java.lang.reflect.Method.invoke (Method.java:491)
10-12 15: 01: 10.360: WARN / System.err (18679): на com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:841)
10-12 15: 01: 10.360: WARN / System.err (18679): на com.android.internal.os.ZygoteInit.main (ZygoteInit.java:599)
10-12 15: 01: 10.360: WARN / System.err (18679): at dalvik.system.NativeStart.main (собственный метод)
Есть идеи, как мне это решить? заранее спасибо