How to delete a file using Access Access Framework?

How can I delete files using Storage Access Framework in Android? I found this method in the documentation, but could not get it to work: DocumentsContract.deleteDocument (ContentResolver, Uri);

Is it possible to delete a specific file without asking the user what to delete with this?

Edit:

I tried to get uri file with Uri.fromFile, with null pointer error. I tried to get the uri file using ACTION_OPEN_DOCUMENT, but it asks the user to select the file (I want to specify the file myself). Even as if it didn’t work, giving an exception and saying that I delete unsupported.

+4
source share
1 answer

, URI , Document.COLUMN_FLAGS SUPPORTS_DELETE, . :

DocumentsContract.deleteDocument(getContentResolver(), uri);

: http://developer.android.com/guide/topics/providers/document-provider.html

0

Source: https://habr.com/ru/post/1613955/


All Articles