I am trying to create a bitmap image from my Android gallery. I do this in an AsyncTask and this is the reason why I have a cursor in my implementation. The code is the following
try {
uri = Uri.parse(uriStr);
} catch (Exception e) {
Log.e(LOG_TAG, "problem with the image loading: " + e);
}
if(uri == null)
continue;
Bitmap bm = null;
try{
bm = MediaStore.Images.Media.getBitmap(activity.getContentResolver(), uri);
} catch (FileNotFoundException e) {
Log.e(LOG_TAG, "Bitmap not found: " + e);
} catch (IOException e) {
Log.e(LOG_TAG, "Bitmap IO error: " + e);
When I debug, I notice there is a FileNotFoundException thrown, the output:
08-17 13:47:55.754 30333-30668/com.example.jonas.shoppinglist W/System.err﹕ java.io.FileNotFoundException: No content provider: /storage/emulated/0/Download/unnamed.jpg 08-17 13:47:55.833 30333-30668/com.example.jonas.shoppinglist W/System.err﹕ at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1086) 08-17 13:47:55.921 30333-30668/com.example.jonas.shoppinglist W/System.err﹕ at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:941) 08-17 13:47:55.975 30333-30668/com.example.jonas.shoppinglist W/System.err﹕ at android.content.ContentResolver.openInputStream(ContentResolver.java:666) 08-17 13:47:56.019 30333-30668/com.example.jonas.shoppinglist W/System.err﹕ at android.provider.MediaStore$Images$Media.getBitmap(MediaStore.java:849) 08-17 13:47:56.062 30333-30668/com.example.jonas.shoppinglist W/System.err﹕ at com.example.jonas.shoppinglist.processes.ShoppingGallery.doInBackground(ShoppingGallery.java:51)
The result is that I didn't get one single bitmap image of my gallery. What is the problem?