getExternalFilesDir()與getExternalStorageDirectory()區別

getExternalFilesDir()

It returns the path to files folder inside Android/data/data/your_package/ on your SD card. It is used to store any required files for your app (e.g. images downloaded from web or cache files). Once the app is uninstalled, any data stored in this folder is gone too.

獲取應用程序下的存儲目錄,/data/data/your_package/,隨着應用的卸載存儲的文件被刪除

getExternalStorageDirectory()

It returns the root path to your SD card (e.g mnt/sdcard/). If you save data on this path and uninstall the app, that data won't be lost.

獲取sd卡根目錄,跟應用的是否卸載無關。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章