1. 程式人生 > >Android資料儲存路徑位置

Android資料儲存路徑位置

File filepathq = getFilesDir();
File filepathw = getCacheDir();
File filepathe = getExternalCacheDir();
File filepathr = getExternalFilesDir("dsaf");
File filepatht = Environment.getExternalStorageDirectory();
File filepathy = Environment.getExternalStoragePublicDirectory("egvd");

Log.e("debug", "getFilesDir="+filepathq.getAbsolutePath());
Log.e("debug", "getCacheDir="+filepathw.getAbsolutePath());
Log.e("debug", "getExternalCacheDir="+filepathe.getAbsolutePath());
Log.e("debug", "getExternalFilesDir="+filepathr.getAbsolutePath());
Log.e("debug", "getExternalStorageDirectory="+filepatht.getAbsolutePath());

Log.e("debug", "getExternalStoragePublicDirectory="+filepathy.getAbsolutePath());

列印結果:

 getFilesDir=/data/user/0/com.example.mtonlyidentification/files
getCacheDir=/data/user/0/com.example.mtonlyidentification/cache
getExternalCacheDir=/storage/emulated/0/Android/data/com.example.mtonlyidentification/cache
 getExternalFilesDir=/storage/emulated/0/Android/data/com.example.mtonlyidentification/files/dsaf
getExternalStorageDirectory=/storage/emulated/0
getExternalStoragePublicDirectory=/storage/emulated/0/egvd