How to delete a file from an Android application? Can I do this the same way as deleting a file in Java?
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
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
AndroidManifest.xml
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!)
File.delete()
, , -: , Android , ! ( , )
File file = new File(path); return file.delete();
Source: https://habr.com/ru/post/1732961/More articles:"Заполнение недопустимо и не может быть удалено" - не так ли с этим кодом? - c#What is in memory location 1 on an Intel x86 computer running Windows XP? - assemblyКак избежать недопустимого пространства поиска в генетическом алгоритме? - computer-sciencePerformance testing. How much data should I create? - performanceAccess denied message when deploying spring application to tomcat 6 - javaHow to run WebDevServer from a .sln file without opening Visual Studio 2008 - visual-studio-2008adb cannot find my Android debugging device. What for? - javaEquivalent to toString () in Eclipse for debugging GDB - c ++looking forward to evaluating boolean expressions in Python - pythonUploadError 403 in swfupload for Firefox - javaAll Articles