mardi 4 août 2015

FileNotFoundException when calling getContentResolver().openInputStream

I am getting following stacktrace when trying to call openInputStream:

java.io.FileNotFoundException
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:691)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1080)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:921)
at android.content.ContentResolver.openInputStream(ContentResolver.java:646)

But the problem does occur only in special situation. As shown in the following Screenshot, it only fails in the very first "Box"-option (red marker) - everything else is working perfectly fine, Google Drive, internal storage, Box from the bottom selection (marked green).

enter image description here

The code for the ACTION_GET_CONTENT-intent:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent, PICKFILE_RESULT_CODE);

This intent returns following URI after selecting a file:

content://com.box.android.documents/document/file%2C33633304153

When I call getContentResolver().openInputStream(uri) in onActivityResult I get the above shown stracktrace.

Any ideas whats going wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire