In the need of storage, the problem of the path is more confusing for beginners, the following is for Getcachedir (), Getfilesdir (), Getexternalfilesdir (), Getexternalcachedir () Some of the experience, Only for the reference of the Si-mi ...
Preferred, need to be clear is the path of the respective representative where the specific location
Getcachedir () Path:/data/data/App package name/cache/directory
Getfilesdir () Path:/data/data/App package name/files/directory
Getexternalfilesdir () Path: sdcard/android/data/App package name/files/directory
Getexternalcachedir () Path:/sdcard/android/data/App package name/cache/directory
The biggest difference between these methods is the location of the store and whether the application will have residual data after it is uninstalled.
Use the following path:
Getexternalfilesdir () Path: sdcard/android/data/App package name/files/directory
Getexternalcachedir () Path:/sdcard/android/data/App package name/cache/directory
getExternalStorageDirectory() corresponding path: SD card root directory
Both of these methods when your app is uninstalled, the sdcard/android/data/app package name/All files in this directory will be deleted, leaving no spam messages.
All the things you download that need to be resident SD card data cannot be written into this area
And there's a way that we often seegetExternalStorageDirectory(),那么它和上述的getExternalFilesDir()方法又有什么异同?
The main difference is that data stored under the Getexternalfilesdir () path is unloaded as the application unloads.
Path to cache and SD card (original)