public String getimagepath () {
String path = null;
/**
* 获取sd卡最后一张照片
*/
ContentResolver mResolver = MainActivity.this.getContentResolver();
String[] projection = new String[]{MediaStore.Images.Media.DATA,MediaStore.Images.Media.DATE_ADDED,"MAX("+MediaStore.Images.Media.DATE_ADDED+")"};
Cursor cursor = mResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, null, null, MediaStore.Images.Media.DEFAULT_SORT_ORDER);
cursor.moveToFirst();
while(!cursor.isAfterLast()){
Log.i("Tag", cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA)));
path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
cursor.moveToNext();
}
cursor.close();
return path;
}