开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜