我在这里附上日志:
Caused by: java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/1587
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:165)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:418)
我使用的代码运行良好,但对于下载管理器,它在“try”块的第一行引发异常
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
我已经试过了:
Android getting file path from content URI using contentResolver
而这:
java.lang.IllegalArgumentException: Unknown URI content
还有一些和这个问题有关,但没有一个能解决我的问题。