android路径获取

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

//内部路径

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


// 存储卡路径

Environment.getExternalStorageDirectory()=/storage/sdcard0


// 可选值DIRECTORY_MUSIC, DIRECTORY_PODCASTS, DIRECTORY_RINGTONES, 

// DIRECTORY_ALARMS, DIRECTORY_NOTIFICATIONS, DIRECTORY_PICTURES, 

// DIRECTORY_MOVIES, DIRECTORY_DOWNLOADS, or DIRECTORY_DCIM. 不能为null

Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC)=/storage/sdcard0/Music


// 与context.getFilesDir(相似,删除应用时会同时删除

context.getExternalFilesDir()=/storage/sdcard0/Android/data/com.penngo.test/files

// 与context.getCacheDir()相似,删除应用时会同时删除

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()=/.



//判断存储卡是否存在

public static boolean isSdCardExist() {

  if (Environment.getExternalStorageState().equals(

    Environment.MEDIA_MOUNTED)) {//判断是否已经挂载

   return true;

  }

  return false;

 }