Hi I am developing an Android Gallery app where I am fetching images from built in gallery and displaying it.I am using the code as below
String[] projection = {MediaStore.Images.Thumbnails._ID};
Cursor cursor = getContentResolver().query(MediaStore.Images.Thumbnails.INTERNAL_CONTENT_URI,
projection, // Which columns to return
null, // Return all rows
null,
null);
int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
int size = cursor.getCount();
// If size is 0, there are no images on the SD Card.
if (size == 0)
{
Log.e("size 0","0");
}
The Problem is when I run this code on Phones having only internal storage (Galaxy Nexus) I am getting Log which says size as Zero even though there are images in built in gallery. How do I resolve this. Please Help.Thanks!