How to delete folders from SDCard during uninstalling of my app in Android?

后端 未结 4 1759
猫巷女王i
猫巷女王i 2021-01-18 21:01

I went through the following link which says that the external folders will be deleted automatically during uninstallation of my app.

I am using the following code t

4条回答
  •  借酒劲吻你
    2021-01-18 21:04

    Hey the link says that If you use getExternalCacheDir(), then only folders auto deleted when uninstalling the app. So please correct your self. If you are using getExternalStorageDirectory , then you have to manually delete the folder by programming

    to delete a folder you can use below code

    String TEMP_FOLDER_PATH = Environment.getExternalStorageDirectory() + "/myAppFolder/";

        File f1=new File(TEMP_FOLDER_PATH);
        f1.delete();
    

提交回复
热议问题