Directory structure:
contents Structure [+]
- Internal Path
- External path
The paths in Android are mainly divided into internal and external paths.
I. Internal path
The common internal storage paths are:
File f1=environment.getdatadirectory ();///dataFile f2=environment.getdownloadcachedirectory ();///cacheFile f3=environment.getrootdirectory ();///systemFile f4=Context. Getcachedir ();///data/data/com.example.fileexiststest/cacheFile f5=Context. Getdatabasepath ("abc.db");///data/data/com.example.fileexiststest/databases/abc.dbFile f6=Context. Getfilesdir ();///data/data/com.example.fileexiststest/filesFile f7=Context. Getfilestreampath ("Test2.txt");///data/data/com.example.fileexiststest/files/test2.txt
It is important to note that the folders and files stored internally are only visible after the root of the phone, and the files in the internal path are generally read-only.
As can be seen from the above observation, the internal storage of the public cache path under the/cache file, the private cache path under the/data/data/package name/under each private cache path has three subdirectories, respectively, Cache,databases,files. Cache path is used for caching, databases path is to store the database files, the usual use of the Sqllite database is stored in this directory, files is to store other files.
Two. External path
The common external paths are:
File f1=environment.getexternalstoragedirectory ();///storage/emulated/0File f2=environment.getexternalstoragepublicdirectory ("abc");///STORAGE/EMULATED/0/ABCFile f3= This. Getexternalcachedir ();///storage/emulated/0/android/data/com.example.fileexiststest/cacheFile f4= This. Getexternalfilesdir ("test");///storage/emulated/0/android/data/com.example.fileexiststest/files/testFile f5= This. Getobbdir ();///storage/emulated/0/android/obb/com.example.fileexiststest
In the memory of the phone, you can find/storage/emulated/0 this directory, but there is no data, but to see the size of this directory is found to have data, this is because the data is hidden.
The/storage/emulated/0 directory is an externally stored directory.
As you have learned, the memory-stored files are read-only and if you want to write data, you have to save them in the external path.
Both the external path and the memory path have the same structure. It is also divided into common path and private path, the common path can be arbitrarily built files and directories to store data. The format of the private directory is/android/data/package name/. The data of the public path can be accessed by all programs, and the data under the private path is accessible only by the current program.
"Android" resolves the path of Android