【发布时间】:2021-03-02 14:39:30
【问题描述】:
System.out.println(DatabaseUtils.dumpCursorToString(cursor));
URI uri = new File(path).toURI();
getApplicationContext().getContentResolver().delete(uri, null, null);//This is the one giving the error
new File(path).delete();
refreshCursor();
setTheImage();
我正在尝试从 MediaStore 中删除一张照片。在这段代码上,它给了我这个错误:
'android.content.ContentResolver' 中的'delete(android.net.Uri, java.lang.String, java.lang.String[])' 不能应用于'(java.net.URI, null, null )'
但是,关于它的官方文档说第二个和第三个值允许为空。 这里有什么问题?
这是官方文档的照片:https://imgur.com/a/OenSEL7
Here 是官方文档本身。
【问题讨论】:
-
@RyanM 问题已经得到解答,谢谢
标签: java android mediastore