Each Android app has its own controllable directory.
In Setting/application info, you can see each application with the clear data and clear cache options.
Where are the specific directories?
Connect the device with ADB. If you are connecting to a real device, you need to have root access to the device.
CD Data/data
In this directory, you can see that each application has its own directory, and the directory name is the package that the application defines in the Androidmanifest.xml file.
In each directory, there are typically a few sub-directories:
Databases: Storing the database
Cache: Storing Cached data
Files: file that holds the application's own control
LIB: Storing the packages used
The code for each application has absolute control over its own directory.
These directories can be obtained in the activity:
Context cont = This.getapplicationcontext ();
LOG.D ("Temppjactivity", "cont.getcachedir () =" + Cont.getcachedir ());
LOG.D ("Temppjactivity", "Cont.getdatabasepath (" temp ") =" + Cont.getdatabasepath ("temp"));
LOG.D ("Temppjactivity", "cont.getfilesdir () =" + Cont.getfilesdir ());
Where the database path is required to pass in the database name, the return value is as follows:
08-26 08:04:01.049:debug/temppjactivity (): cont.getcachedir () =/data/data/com.study/cache
08-26 08:04:01.049:debug/temppjactivity: Cont.getdatabasepath ("temp") =/data/data/com.study/databases/temp
08-26 08:04:01.099:debug/temppjactivity (): cont.getfilesdir () =/data/data/com.study/files
In addition, you can get the path of your own apk.
LOG.D ("Temppjactivity", "cont.getpackagecodepath () =" + Cont.getpackagecodepath ());
LOG.D ("Temppjactivity", "cont.getpackageresourcepath () =" + Cont.getpackageresourcepath ());
Results:
08-26 08:04:01.099:debug/temppjactivity (): Cont.getpackagecodepath () =/data/app/com.study-1.apk
08-26 08:04:01.099:debug/temppjactivity (): Cont.getpackageresourcepath () =/data/app/com.study-1.apk
Transferred from: http://blog.csdn.net/yihui823/article/details/6722456
Data storage directory commentary for the "Go" Android app