gpt4 book ai didi

java.lang.IllegalArgumentException : Unknown URL file at android. content.ContentResolver.delete

转载 作者:行者123 更新时间:2023-12-02 05:23:34 25 4
gpt4 key购买 nike

出现上述错误

builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {

if (mImageCaptureUri != null)
{
//exception at below line
getContentResolver().delete(mImageCaptureUri, null,null);
mImageCaptureUri = null;
}
}
});

我尝试通过 new File(mImageCaptureUri.getPath()).exists() 检查文件是否存在它存在,但我仍然收到异常

java.lang.IllegalArgumentException: Unknown URL file:///storage/sdcard0/tmp_avatar_1412858553212.jpg    
at android.content.ContentResolver.delete(ContentResolver.java:984)

最佳答案

I tried checking if file exists by new File(mImageCaptureUri.getPath()).exists() it exists

请注意 there is no requirement that a Uri point to a file that you can access .

still i'm getting the exception as

java.lang.IllegalArgumentException: Unknown URL file:///storage/sdcard0/tmp_avatar_1412858553212.jpg at android.content.ContentResolver.delete(ContentResolver.java:984) 

ContentResolver 主要用于 content:// 方案。对于 file:// 方案,您可能需要尝试自己直接删除文件。

关于java.lang.IllegalArgumentException : Unknown URL file at android. content.ContentResolver.delete,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26278748/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com