android 文档路径获取

public static void getFile(Context context){
LogDcjet.e("hanlx", "Environment.getExternalStorageDirectory()" + 
Environment.getExternalStorageDirectory().getAbsolutePath()); 
// /storage/sdcard1

LogDcjet.e("hanlx", "Environment.getDataDirectory()" + 
Environment.getDataDirectory().getAbsolutePath()); 
// /data
 
LogDcjet.e("hanlx", context.getCacheDir().getAbsolutePath());
// /data/data/com.dcjet.oa/cache
 
LogDcjet.e("hanlx", context.getExternalCacheDir().getAbsolutePath()); 
// /storage/sdcard1/Android/data/com.dcjet.oa/cache
 
LogDcjet.e("hanlx", context.getExternalFilesDir(null).getAbsolutePath()); 
///storage/sdcard1/Android/data/com.dcjet.oa/files
 
LogDcjet.e("hanlx", context.getFilesDir().getAbsolutePath()); 
// /data/data/com.dcjet.oa/files
 
Log.d("hanlx", Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED) + "");
//true
 
//以上是默认存储位置设为SD卡,保存在外存的数据保存在SD卡上
//以下是默认存储位置设为内存设备,保存到外存的数据保存在手机上,不root用文件管理器可以看到,卸载了sd卡判断外存是否存在,结果是true;
 
 
//  /storage/emulated/0
// /data
//  /data/data/com.dcjet.oa/cache
// /storage/emulated/0/Android/data/com.dcjet.oa/cache
// /storage/emulated/0/Android/data/com.dcjet.oa/files
// /data/data/com.dcjet.oa/files
//       true

你可能感兴趣的:(android)