Reputation: 924
I want to get URI or Path of all the Images of SDCARD.
How I can achieve this ?
Thanks.
Upvotes: 1
Views: 2961
Reputation: 56925
Please try this.
String[] STAR = { "*" };
Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI
, STAR, null, null, null);
if (cursor != null)
{
if (cursor.moveToFirst())
{
do
{
String path = cursor.getString(cursor
.getColumnIndex(MediaStore.Images.Media.DATA));
Log.i("Path",path);
}while (cursor.moveToNext());
}
cursor.close();
}
Do not forget to give permission in manifest for reading sdcard.
Upvotes: 5