Here I am attaching the logs :
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)
I am using this code which is working fine.But for the case of download manager it is throwing exception at first line of 'try' block
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;
I already tried this: Android getting file path from content URI using contentResolver and this: java.lang.IllegalArgumentException: Unknown URI content and some others related to this question but not any one of them resolves my problem.
query(uri, projection, selection, selectionArgs, null);
? – Natica