Get Uri of All Images in SDCard in Android
I want to get URI or Path of all the Image开发者_StackOverflow社区s of SDCARD.
How I can achieve this ?
Thanks.
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();
}
Note
Do not forget to give permission in manifest for reading sdcard.
精彩评论