Android app development will involve the preservation of different data, such as data cache, customer login information preservation, customer status preservation and so on.
So where do we keep the different data?
1, the application uninstall also will not delete data
Create a folder directly in the SDcard root directory to save the data.
Advantages: Long save time, application uninstall will not be deleted. Cons: Anyone can access this directory.
2, following the existence of the application of data
The Context.getexternalfilesdir () method can get the package name to sdcard/android/data/your app/files/
The above directory will be removed as the app is uninstalled, this directory corresponds to the "Erase data" option in the app-to-application details of Android phone settings, which will be deleted when the user clicks this.
Context.getfilesdir () can get to "/data/data/<package Name>/files" This method gets to the files directory under the app's installation directory.
3, the application of the cache directory system will be automatically scheduled cleanup,
< Span style= "color: #444444; font-family: ' Microsoft yahei ', Tahoma,simsun; font-size:14px; line-height:21px; " > context.g The Etexternalcachedir () method can get to sdcard/android/data/your app package name/cache/
The above directory is the cache directory of the SD card, which can beStore temporary cache data This directory corresponds to settings--Application---application details in the "clear cache, the user click on this option will clear the data in this directory
< Span style= "color: #444444; font-family: ' Microsoft yahei ', Tahoma,simsun; font-size:14px; line-height:21px; " > < Span style= "color: #444444; font-family: ' Microsoft yahei ', Tahoma,simsun; font-size:14px; line-height:21px; " > < Span style= "color: #444444; font-family: ' Microsoft yahei ', Tahoma,simsun; font-size:14px; line-height:21px; " >
< Span style= "color: #444444; font-family: ' Microsoft yahei ', Tahoma,simsun; font-size:14px; line-height:21px; " > < Span style= "color: #444444; font-family: ' Microsoft yahei ', Tahoma,simsun; font-size:14px; line-height:21px; " > context. Application installation directory cache directory
http://blog.csdn.net/yihui823/article/details/6722456
Where should the data for Android apps be saved?