在我的应用程序中,我想仅显示来自 Gridview 中 Camera 文件夹的图像。我编写了以下代码来导入图像:-
String[] projection = { MediaStore.Images.Thumbnails._ID, };
Cursor mImageCursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, null );
if (mImageCursor != null)
{
mImageCursor.moveToFirst();
for (int i = 0; i < mImageCursor.getCount(); i++)
{
Images im=new Images();
int imageId = mImageCursor.getInt((mImageCursor.getColumnIndex( MediaStore.Images.Media._ID)));
Bitmap bm = MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(),
imageId, MediaStore.Images.Thumbnails.MINI_KIND, null);
im.setBitmap(bm);
arrayOfImages.add(im);
mImageCursor.moveToNext();
}
}
但是此代码从图库中导入所有图像。但我只想从相机文件夹中导入图像。p