External Storage 数据存储

时间:2025-01-19 13:35:02

一些数据存储的封装:http://hubingforever.blog.163.com/blog/static/17104057920129198236599/

External Storage数据存储使用方法

Environment.getDataDirectory() = /data
Environment.getDownloadCacheDirectory() = /cache
//外部存储卡路径
Environment.getExternalStorageDirectory() = /mnt/sdcard
Environment.getExternalStoragePublicDirectory(“test”) = /mnt/sdcard/test
Environment.getRootDirectory() = /system
getPackageCodePath() = /data/app/com.my.app-1.apk
getPackageResourcePath() = /data/app/com.my.app-1.apk //应用目录下路径
getCacheDir() = /data/data/com.my.app/cache
getDatabasePath(“test”) = /data/data/com.my.app/databases/test
getDir(“test”, Context.MODE_PRIVATE) = /data/data/com.my.app/app_test
getFilesDir() = /data/data/com.my.app/files
getExternalCacheDir() = /mnt/sdcard/Android/data/com.my.app/cache
getExternalFilesDir(“test”) = /mnt/sdcard/Android/data/com.my.app/files/test
getExternalFilesDir(null) = /mnt/sdcard/Android/data/com.my.app/files