android Uri获取真实路径转换成File的方法
Uri uri = data.getData(); |
02 |
03 |
String[] proj = { MediaStore.Images.Media.DATA }; |
04 |
05 |
Cursor actualimagecursor = managedQuery(uri,proj, null , null , null ); |
06 |
07 |
int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); |
08 |
09 |
actualimagecursor.moveToFirst(); |
10 |
11 |
String img_path = actualimagecursor.getString(actual_image_column_index); |
12 |
13 |
File file = new File(img_path); |