【发布时间】:2013-12-14 03:42:09
【问题描述】:
由于我支持我的应用程序到 Kitkat 版本,现在从图库中检索文件的方式有所不同。
我更喜欢这个Android Gallery on KitKat returns different Uri for Intent.ACTION_GET_CONTENT 从图库中检索文件并成功工作,但我需要该文件的绝对路径,我得到了
content://com.android.providers.media.documents/document/image:2505
对于低于 19 的版本,我们使用不同的 uri,因为我使用这种方式获取路径
Cursor cursor = this.getContentResolver().query(originalUri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String fpath = cursor.getString(column_index);
但在 19 版本中,它会给我空值如何获取用户选择的图像文件的绝对路径。
谢谢
【问题讨论】: