Get the Android file path

Source: Internet
Author: User

Environment.getdatadirectory (). GetPath ():/data

Environment.getdownloadcachedirectory (). GetPath ():/cache
Environment.getexternalstoragedirectory (). GetPath ():/mnt/sdcard
Environment.getrootdirectory (). GetPath ():/system
Context.getcachedir (). GetPath ():/data/data/Package name/cache
Context.getexternalcachedir (). GetPath ():/mnt/sdcard/android/data/Package name/cache
Context.getfilesdir (). GetPath ():/data/data/Package name/files
Context.getobbdir (). GetPath ():/mnt/sdcard/android/obb/package Name
Context.getpackagename (): Package name
Context.getpackagecodepath ():/data/app/app Name
Context.getpackageresourcepath ():/data/app/app Name


/data/data/cn.tony.app/files/This path may be obtained by invoking Getfilesdir in the context subclass (Activity,service, and so on) under the package named "Cn.tony.app".

/mnt/sdcard/, however, should be available on Android systems below 4.0, via the Environment class's getExternalStorageDirectory method.

In fact, getexternalstoragedirectory this method, rather, is to get the default memory. In different versions of the Android system, the point of location is not the same. For example, on more than 4.0 of the system, it generally points to "storage/sdcard0" (Built-in SD card), but there are manufacturers or individuals to set it to "Storage/sdcard1" (external SD card). Like window, the system is usually installed in the C drive, but in the D drive can actually.

Get the Android file path

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.