android 根据uri获取路径

Uri uri = data.getData();

String[] proj = { MediaStore.Images.Media.DATA };

Cursor actualimagecursor = managedQuery(uri,proj,null,null,null);

int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);

actualimagecursor.moveToFirst();

String img_path = actualimagecursor.getString(actual_image_column_index);

File file = new File(img_path);

转载自:https://blog.csdn.net/u013378266/article/details/46560307

You may also like...