15、android 常用文件路径备忘

1、Environment

     1   String dataDir = Environment.getDataDirectory().getAbsolutePath();
        Log.i("dataDir", "得到---" + dataDir);
    // /data
      2  String extstrDir = Environment.getExternalStorageDirectory().getAbsolutePath();
        Log.i("extstrDir", "得到---" + extstrDir);
   // /storage/emulated/0
      3  String downloadDir = Environment.getDownloadCacheDirectory().getAbsolutePath();
        Log.i("downloadDir", "得到---" + downloadDir);

// /cache

  4  String downloadDir = Environment.getDownloadCacheDirectory().getAbsolutePath();
        Log.i("downloadDir", "得到---" + downloadDir);
    // /cache
   5  String rootDir = Environment.getRootDirectory().getAbsolutePath();
        Log.i("rootDir", "得到---" + rootDir);  
    // /system

   6   String dcim =Environment.
getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
    .getAbsolutePath();
        Log.i("dcim", "得到---" + dcim);
// /storage/emulated/0/DCIM     

2、package

    7  String packagePath = context.getFilesDir().getAbsolutePath();
        Log.i("packagePath", "得到---" + packagePath);
    // /data/user/0/com.cloud.wd.tralanguage/files
   8   String appCache = context.getCacheDir().getAbsolutePath();
        Log.i("appCache", "得到---" + appCache);  
    // /data/user/0/com.cloud.wd.tralanguage/cache
  9   String pic = context.getExternalFilesDir(Environment.DIRECTORY_DCIM)
         .getAbsolutePath();
        Log.i("pic", "得到---" + pic);  
    // /storage/emulated/0/Android/data/com.cloud.wd.tralanguage/files/DCIM

你可能感兴趣的:(android,基础知识)