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();
I am trying to delete a photo from MediaStore. On this piece of code, it gives me this error:
'delete(android.net.Uri, java.lang.String, java.lang.String[])' in 'android.content.ContentResolver' cannot be applied to '(java.net.URI, null, null)'
However, the official documentation about it says that second and third values are allowed to be null. What is the problem here?
Here is a photo of the official documentation: https://i.stack.imgur.com/WY6AD.jpg
Here is the official documentation itself.