Where is the best place for Android to cache data locally?
I have not known the sdcard/android directory what role, I do the project inside the cache data to the local generally on the sdcard to build a file, and then put the data in this folder under the Sub-folder. A better workaround is described below.
In the process of running the application, if you need to save data to the phone, the data is usually saved in 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
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 "Clear data" and "clear cache" options in the above two directories corresponding to the application details of settings--
summarize some of the directories in Android:
1, through the Context.getexternalfilesdir () method can 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
2, Context.getfilesdir () can get to "/data/data/<package Name>/files" This method obtains the directory is not on the sdcard, but in the application installs the directory
Context.getcachedir can get to "/data/data/<package Name>/cache" This method obtains the directory is not on the sdcard, but in the application installs the directory, The data in this file is deleted by the system when the device is running out of memory. Note: You can not rely on the system to help you delete these files, when the data in this folder more than 1MB, the system will delete the data in this folder.
Android Cache Data Analysis