常用的android访问路径

时间:2022-08-07 08:19:48

常用的android访问路径

    //Environment.getDataDirectory()--->/data

//Environment.getDownloadCacheDirectory()--->/cache

//Environment.getExternalStorageDirectory()--->/storage/emulated/0

// Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC)--->/storage/emulated/0/Music

//Environment.getRootDirectory()--->/system

//getApplication().getExternalCacheDir()--->/storage/emulated/0/Android/data/com.zopodo.terminal/cache

//getApplication().getExternalFilesDir(android.os.Environment.DIRECTORY_MUSIC)--->/storage/emulated/0/Android/data/com.zopodo.terminal/files/Music

//getApplication().getCacheDir()--->/data/data/com.zopodo.terminal/cache

//getApplication().getFilesDir()--->/data/data/com.zopodo.terminal/files
//下面这个方法受限于api 24
//Log.d("Q_M", " getApplication().getDataDir()--->" + getApplication().getDataDir());

//getApplication().getFileStreamPath("yourfile")--->/data/data/com.zopodo.terminal/files/yourfile

//getApplication().getObbDir()--->/storage/emulated/0/Android/obb/com.zopodo.terminal

//getApplicationInfo().dataDir--->/data/data/co.zopodo.terminal

//getApplicationInfo().publicSourceDir--->/data/app/com.zopodo.terminal/base.apk

//getApplicationInfo().sourceDir--->/data/app/me.febsky.debug-1/base.apk


///data/data/me.febsky.debug/app_yourfile 执行这行代码会 创建名为app_yourfile 的文件夹
Log.d("Q_M", "getBaseContext().getDir--->" + getBaseContext().getDir("yourfile", MODE_PRIVATE));
//下面省略和getApplication 中相同的方法,Application也是间接继承自Context类