android中去获取SD卡下指定目录的图片问题
public void getImages(Context context) {
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
ContentResolver contentResolver = context.getContentResolver();
String[] projection = {MediaStore.Images.Media._ID,
MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.DATA, MediaStore.Images.Media.SIZE};
String selection = MediaStore.Images.Media.DATA + " like %?";
String photoPath = "sdcard/iermu/cache/share";
// String[] selectionArgs = {"image/jpeg"};
String[] selectionArgs ={photoPath+"%"};
// select Projections from URI where Selections
String sortOrder = MediaStore.Images.Media.DATE_MODIFIED + " desc";
Cursor cursor = contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, selection,
selectionArgs, sortOrder);
List<HashMap<String, String>> imageList = new ArrayList<HashMap<String, String>>();
if (cursor != null) {
HashMap<String, String> imageMap = null;
cursor.moveToFirst();
while (cursor.moveToNext()) {
imageMap = new HashMap<String, String>();
imageMap.put("imageID", cursor.getString(cursor
.getColumnIndex(MediaStore.Images.Media._ID)));
imageMap.put("imageName", cursor.getString(cursor
.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME)));
imageMap.put("data", cursor.getString(cursor
.getColumnIndex(MediaStore.Images.Media.DATA)));
String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
String parentPath = new File(path).getParentFile().getName();
// if (parentPath.equals("相册")){
imageList.add(imageMap);
// }
}
// 关闭cursor
cursor.close();
一直提示 语法 错误 ,求助大神呀