How to delete a file from an Android application

How to delete a file from an Android application? Can I do this the same way as deleting a file in Java?

+3
source share
3 answers
File file = new File(selectedFilePath);
boolean deleted = file.delete();

and set this permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
in the AndroidManifest.xmlfile

+3
source

The Android developer site has a really good developer guide section.

Answer your question: Files can be deleted using the method File.delete(). (I found that by searching “delete file” on the page above!)

, , -: , Android , ! ( , )

+2
    File file = new File(path);
    return file.delete();   
+1
source

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


All Articles