我正在使用Glide图像加载器从特定URL加载图像,现在如果我将图像更新为相同的URL,Glide仍在我的imageview中显示缓存的图像.如何从同一个URL重新加载图像?
我在这里附上日志:
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)
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码,效果很好。但是对于下载管理器,它在``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;
Run Code Online (Sandbox Code Playgroud)
我已经尝试过:Android使用contentResolver从内容URI获取文件路径, 并且:java.lang.IllegalArgumentException:未知的URI内容以及与此问题相关的其他一些内容,但没有一个解决了我的问题。
android uri android-contentprovider android-download-manager android-8.0-oreo
正如我在Android文档中所看到的,在将用户发送到另一个应用程序时尝试构建隐式意图。这是避免ActivityNotFoundException的两种方法。
第一 :
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
PackageManager packageManager = getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
boolean isIntentSafe = activities.size() > 0;
Run Code Online (Sandbox Code Playgroud)
第二个 :
Intent chooser = Intent.createChooser(intent, title);
if (intent.resolveActivity(getPackageManager()) != null) {
}
Run Code Online (Sandbox Code Playgroud)
现在,我的疑问是区别是什么,我应该使用哪一个?
android android-intent android-activity android-implicit-intent
在 Android 10 之前,我使用TelephonyManagerAPI 来检索该信息,但它不再适用于 Android 10。