Search code examples
androidstorageinternal

Android delete settings/files from Internal Storage


IS there any function which can delete all folders of my application in Internal Storage. I need a way to reset my application and to clear all saved files/settings/databases in my application's folder in internal storage. Which is the best way to achieve this?

EDIT:

Code I'm using :

String name = context.getFilesDir()+"/documents/users/stampiiii/2345/data/";
Log.e("","path : "+name);
File myDir = new File(name);
myDir.delete();
boolean iff = myDir.delete();
Log.e("","iff : "+iff);

Thanks in advance for suggestions/help/advice!


Solution

  • Try Context.deleteFile()

    public abstract boolean  deleteFile  (String name)
    

    Delete the given private file associated with this Context's application package.

    Or

    File file = new File("File path");
                        boolean deleted = file.delete();