Path to cache and SD card (original)

Source: Internet
Author: User

In the need of storage, the problem of the path is more confusing for beginners, the following is for Getcachedir (), Getfilesdir (), Getexternalfilesdir (), Getexternalcachedir () Some of the experience, Only for the reference of the Si-mi ...

Preferred, need to be clear is the path of the respective representative where the specific location

Getcachedir () Path:/data/data/App package name/cache/directory

Getfilesdir () Path:/data/data/App package name/files/directory

Getexternalfilesdir () Path: sdcard/android/data/App package name/files/directory

Getexternalcachedir () Path:/sdcard/android/data/App package name/cache/directory

The biggest difference between these methods is the location of the store and whether the application will have residual data after it is uninstalled.

Use the following path:

Getexternalfilesdir () Path: sdcard/android/data/App package name/files/directory

Getexternalcachedir () Path:/sdcard/android/data/App package name/cache/directory

getExternalStorageDirectory() corresponding path: SD card root directory

Both of these methods when your app is uninstalled, the sdcard/android/data/app package name/All files in this directory will be deleted, leaving no spam messages.

All the things you download that need to be resident SD card data cannot be written into this area

And there's a way that we often seegetExternalStorageDirectory(),那么它和上述的getExternalFilesDir()方法又有什么异同?

The main difference is that data stored under the Getexternalfilesdir () path is unloaded as the application unloads.

Path to cache and SD card (original)

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.