ç±äºç°å¨åå¹³æ¿å¼åï¼å¿
é¡»å¾ååºè¿2个åå¨ã
USB memoryå sdcard
ä¸è¬å°±çEnviromentç±»çæºç ã
public static File getExternalStorageDirectory() {
// Try to be smarter
// Return EXTERNAL_STORAGE_DIRECTORY_SD if SD card is ready
// Return EXTERNAL_STORAGE_DIRECTORY_UDISK if SD card is absent but udisk is ready
// Return EXTERNAL_STORAGE_DIRECTORY_SD if both sd card and udisk are not ready
String propSD = SystemProperties.get("EXTERNAL_STORAGE_STATE_SD", MEDIA_REMOVED);
String propUDISK = SystemProperties.get("EXTERNAL_STORAGE_STATE_UDISK", MEDIA_REMOVED);
String propEXTSD = SystemProperties.get("EXTERNAL_STORAGE_STATE_EXTSD", MEDIA_REMOVED);
if (propSD.equals(MEDIA_MOUNTED) || propSD.equals(MEDIA_MOUNTED_READ_ONLY)) {
return EXTERNAL_STORAGE_DIRECTORY_SD;
} else if (propUDISK.equals(MEDIA_MOUNTED) || propUDISK.equals(MEDIA_MOUNTED_READ_ONLY)) {
return EXTERNAL_STORAGE_DIRECTORY_UDISK;
} else if (propEXTSD.equals(MEDIA_MOUNTED) || propEXTSD.equals(MEDIA_MOUNTED_READ_ONLY)) {
return EXTERNAL_STORAGE_DIRECTORY_EXTSD;} else {return EXTERNAL_STORAGE_DIRECTORY_SD;}}ç¶åEnvironment.getExternalStorageDirectory().getAbsolutePath()
çè¿åçæ¯"/sdcard"è¿æ¯"/udisk"æ¢å¯ã
å¦æä½ ç´æ¥æå®è¿2个路å¾ï¼å»å¾å°éé¢çæ件æ¶ï¼æ¯é误çï¼
温馨提示:答案为网友推荐,仅供参考