先看一个实例:
String[] projection = { MediaStore.Images.Thumbnails._ID ,MediaStore.Images.Thumbnails.DATA};
Cursor cursor = mActivity.getContentResolver().query(
MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,//指定缩略图数据库的Uri
projection,//指定所要查询的字段
MediaStore.Images.Thumbnails._ID + " = ?",//查询条件
new String[] {"" }, //查询条件中问号对应的值
null);
cursor.moveToFirst();
String id = cursor.getString();
String data = cursor.getString();
查询图片缩略图数据库,获取id等于123的缩略图信息。
转换成Sql语句即为 select MediaStore.Images.Thumbnails._ID ,MediaStore.Images.Thumbnails.DATA from MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI where MediaStore.Images.Thumbnails._ID = 123
如果要查询图片,Uri地址为:MediaStore.Images.Media.EXTERNAL_CONTENT_URI
当要获取缩略图时:Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail (mActivity.getContentResolver(), id, Thumbnails.MICRO_KIND, null)