/** * //用户数据目录。/data */ String path1 = Environment.getDataDirectory().getPath(); /** * //下载缓存内容目录。/cache */ String path2 = Environment.getDownloadCacheDirectory().getPath(); /** * //主要的外部存储目录。 /storage/emulated/0 */ String path3 = Environment.getExternalStorageDirectory().getPath(); /** * 外部存储目录很可能当前不能访问,比如这个目录被用户的PC挂载, * 或者从设备中移除,或者其他问题发生, * 你可以通过getExternalStorageState()来获取当前状态。 * * Environment.MEDIA_MOUNTED 等等 */ String path4 = Environment.getExternalStorageState();
/** * 内部存储上的目录 * /data/user/0/程序包名/files */ String path6 = this.getFilesDir().getPath(); /** * 内部存储上的目录 * /data/user/0/程序包名/cache */ String path7 = this.getCacheDir().getPath(); /** * 应用的在外部存储上的缓存目录。 * /storage/emulated/0/Android/data/程序包名/cache */ String path8 = this.getExternalCacheDir().getPath(); /** * 应用在外部存储上的目录。 * /storage/emulated/0/Android/data/程序包名/files/data */ String path = this.getExternalFilesDir(Environment.getDataDirectory().getAbsolutePath()).getAbsolutePath(); /** * 应用在外部存储上的目录。 * /storage/emulated/0/Android/data/程序包名/files */ String path10 = this.getExternalFilesDir("").getAbsolutePath(); /** * 设备的外存是否是用内存模拟的,是则返回true。 */ boolean i = Environment.isExternalStorageEmulated(); /** * 设备的外存是否是可以拆卸的,比如SD卡,是则返回true */ boolean a = Environment.isExternalStorageRemovable(); Log.e("====", path1 + "\n" + path2 + "\n" + path3 + "\n" + path4 + "\n" + "\n" + path6 + "\n" + path7 + "\n" + path8 + "\n" + path + "\n" + path10 + "\n" + i);