/data/data/<package name>/files file operation in Android

Source: Internet
Author: User

/data/data/<package Name>/files


/DATA/DATA/&NBSP; The path is the system-Internal storage file path, which is:/data/data/ <p ackage name> /, each path is based on your own application <p ackage name> under the internal storage path.

Note: files saved in all internal storage will be deleted when the user uninstalls the app .


A. Files
1.Context.getfilesdir (), the method returns/data/data/ <package name> The file object for the/files.
2.context.openfileinput ()Andcontext.openfileoutput (), you can only read and write files under file and return theFileInputStreamAndFileOutputStreamObject.
3.context.filelist (), returns all the file names under files, and returns thestring[]Object.
4.context.deletefile (String), delete the file with the name specified under files.

Second, Cache
1.Context.getcachedir (), the method returns/data/data/<package name>The file object for the/cache.

Third, custom dir

Getdir (String name, int mode), return/data/data/ <p ackage name> /Under the folder that specifies the name of the file object, if the folder does not exist, create a new folder with the specified name.

/data/data/<package name>/files file operation in Android

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.