Android Path acquisition

Source: Internet
Author: User

Internal Path

Environment.getdatadirectory () =/data

Environment.getdownloadcachedirectory () =/cache

Environment.getrootdirectory () =/system

Context.getcachedir () =/data/data/com.penngo.test/cache

Context.getfilesdir () =/data/data/com.penngo.test/files


Memory card Path

Environment.getexternalstoragedirectory () =/storage/sdcard0


Selectable values Directory_music, directory_podcasts, Directory_ringtones,

Directory_alarms, Directory_notifications, Directory_pictures,

Directory_movies, Directory_downloads, or DIRECTORY_DCIM. Cannot be null

Environment.getexternalstoragepublicdirectory (Environment.directory_music) =/storage/sdcard0/music


As with Context.getfilesdir (similar to deleting an app, it is deleted at the same time

Context.getexternalfilesdir () =/storage/sdcard0/android/data/com.penngo.test/files

Similar to Context.getcachedir (), deleting an app deletes it at the same time

Context.getexternalcachedir () =/storage/sdcard0/android/data/com.penngo.test/cache


System.getproperty ("user.home") =

System.getproperty ("Java.io.tmpdir") =/data/data/com.penngo.test/cache

New File (). GetAbsolutePath () =/.



Determine if a memory card exists

public static Boolean issdcardexist () {

if (Environment.getexternalstoragestate (). Equals (

environment.media_mounted)) {//Determine if the mount is already mounted

return true;

}

return false;

}


Android Path acquisition

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.