Data storage directory commentary for the "Go" Android app

Source: Internet
Author: User
Tags root access

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.