The partition of Android 62 mobile phone storage Directory

Source: Internet
Author: User

Android under the application of the path and javase different, the application of the data to save their own folder inside> > Getfiledir (); Get your own folder/data/data/package name (application name)/Files> Getcachedir (); /data/data/Package Name (name of application)/The cache Google gives us a directory of two applications, the files directory, which holds important application data. The phone does not automatically clean up files directories, such as configuration information, the removal of the software is cleared here. The cache directory is a temporary, unimportant data. This directory is specific, when the phone memory space is not enough to automatically clean up the cache directory files, the software to clear the cache is cleared here. # #手机存储空间的划分*Phone internal storage (files and cache, relatively small general 2g4g, Xiaomi Phone memory 16G is included in the external storage SD card,) environment.getdatadirectory ()>file directory cache directory>limited capacity, smaller, more expensive, faster storage access> Created files in the phone's internal storage space, * * Default * *the permissions are all private.>only your own application can access it,>Other applications cannot be accessed.> Why do I need to declare permissions? *Phone External Storage environment.getexternalstoragedirectory ()>SD card>large capacity, can be replaced, inexpensive, 32G less than 200 dollars> Read and Write claims permissions
 Packagecom.itheima.storagesize;ImportJava.io.File;Importandroid.app.Activity;ImportAndroid.os.Bundle;Importandroid.os.Environment;ImportAndroid.text.format.Formatter;ImportAndroid.widget.TextView; Public classMainactivityextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main); File datafile= Environment.getdatadirectory ();//Data internal storage spaceFile sdfile = Environment.getexternalstoragedirectory ();//External storage space        LongDataSize =Datafile.gettotalspace (); LongSdsize = Sdfile.gettotalspace ();//Unit is byteTextView TV =(TextView) Findviewbyid (r.id.tv); Tv.settext ("Internal storage:" + formatter.formatfilesize ( This, datasize) + "\ n" + "external SD card:" + formatter.formatfilesize ( This, sdsize)); //Samsung Millet Meizu//Some manufacturers of SD card directory:/mnt/sdcard//Some manufacturers of SD card directory:/MNT/STORAGE01//Some manufacturers of SD card directory:/MNT/STOARGE02//Some manufacturers of SD card directory:/MNT/MOUNT/STOARGE01            }}

The partition of Android 62 mobile phone storage Directory

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.