//代码在Nexus 5上工作了好几个月,但突然间它停止工作,但是//它在所有其他设备上工作正常,即使是那些具有相同操作系统版本的Kitkat。下面是我的//代码。请建议ASAP。检查Manifest中的所有权限,他们没事。
public static File getPictureStoragePath(int storageLocInt) {
// TODO Auto-generated method stub
String path = Environment.getExternalStorageDirectory()
.getAbsolutePath().toString()
+ "/.DriverMaticsV/"
+ ActiveJourney.JOURNEY_FOLDER_ID
+ "/Picture/";
Map<String, File> externalLocations = ExternalStorage
.getAllStorageLocations();
File sdCard = externalLocations.get(ExternalStorage.SD_CARD);
File externalSdCard = externalLocations
.get(ExternalStorage.EXTERNAL_SD_CARD);
Environment.getExternalStorageState();
//long count = System.currentTimeMillis();
if (sdCard == null) {
path = null;
} else {
path = sdCard.getAbsolutePath() + "/.DriverMaticsV/"
+ ActiveJourney.JOURNEY_FOLDER_ID + "/Picture/";
}
if (externalSdCard != null) {
if (storageLocInt == 0) {
path = sdCard.getAbsolutePath() + "/.DriverMaticsV/"
+ ActiveJourney.JOURNEY_FOLDER_ID + "/Picture/";
} else {
path = externalSdCard.getAbsolutePath() + "/.DriverMaticsV/"
+ ActiveJourney.JOURNEY_FOLDER_ID + "/Picture/";
}
}
File file = new File(path);
if (!file.exists()) {
file.mkdirs();
}
return file;
}