In the process of running the program, if you need to save data to the phone, the data is generally stored in the sdcard. Most applications create a folder directly under the root of the sdcard, and then save the data in that folder.
That way, when the app is uninstalled, the data remains in the SDcard, leaving the junk data. What if you want your app to be uninstalled, and the data associated with that app is erased?
The Context.getexternalfilesdir () method allows you to get to sdcard/android/data/your app's package name/files/directory, usually put some long-time saved data
The Context.getexternalcachedir () method allows you to get to sdcard/android/data/your app package name/cache/directory, typically storing temporary cache data
Note: If you use the above method, when your app is uninstalled by the user, sdcard/android/data/your app's package name/All files in this directory will be deleted, leaving no spam messages.
and the above two directories correspond to settings, respectivelyin the applicationfaceof theClear data and clear cache option, if you want to save the downloaded content, do not put it in the above directory
Also if there are times when it is considered impossible to cache to sdcard, it needs to be cached to the phone. It is not possible to use activity provides Getcachedir () and Getfilesdir () methods:
Getcachedir () method is used to get the/data/data/cache directory
The Getfilesdir () method is used to get the/data/data/files directory