In Android, file operations under/data/& lt; package name & gt;/files, androidpackage

Source: Internet
Author: User

In Android, file operations under/data/<package name>/files, androidpackage

/Data/<package name>/files


/Data/This path is the path of the system's internal storage file, that is,/data/<PAckage name>/, Each path is based on your own application<PAckage name>.

Note: All files stored in the internal storage will be deleted when the user uninstalls the application.


1. files
1. Context. getFilesDir (), this method returns/data/<PAckage name>/Files File object.
2. Context. openFileInput () and Context. openFileOutput () can only read and write files. The returned objects are FileInputStream and FileOutputStream.
3. Context. fileList (): returns all file names under files, and returns the String [] object.
4. Context. deleteFile (String): delete the file with the specified name under files.

Ii. cache
1. Context. getCacheDir (), this method returns/data/<PAckage name>/Cache File object.

Iii. custom dir

GetDir (String name, int mode), returns/data/ <P Ackage name>/. If the folder does not exist, create a new folder with the specified name.

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.