Skip to content Skip to sidebar Skip to footer

Get Images Thumbnail File Paths

I'm trying to get the thumnail paths, not the bitmaps objects. When I query for these, some of the thumbnail paths are null for some reason. (I have 1028 thumbnail images in my dev

Solution 1:

You should query for MediaStore.Images.Thumbnails.DATA. To modify your example, it would look like this.

String[] projection = {MediaStore.Images.Thumbnails.DATA};
// Create the cursor pointing to the SDCardCursorcursor=this.getContentResolver().query( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
        projection, // Which columns to returnnull,       // Return all rowsnull,
        null);
// Get the column index of the Thumbnails Image ID
Log.d(TAG, "BEFORE");
intcolumnIndex= cursor.getColumnIndex(MediaStore.Images.Thumbnails.DATA);
Log.d(TAG, "AFTER1");
for(inti=0;i<cursor.getCount();i++){
    cursor.moveToPosition(i);

    Log.d("MyTag","BBABA" + i +" : " + cursor.getString(columnIndex));
}
cursor.close();

Reference: How to get imagepath from thumbnail path of a image?

Post a Comment for "Get Images Thumbnail File Paths"