private boolean haveSdcard(){
StorageManager manager = (StorageManager) getSystemService(STORAGE_SERVICE);
StorageVolume[] mVolumes=manager.getVolumeList();
String ExternalStorage=null;
for(StorageVolume mVolume:mVolumes){
if(mVolume.isRemovable()){
ExternalStorage=mVolume.getPath();
}
}
if (ExternalStorage != null && testSd(ExternalStorage)) {
return true;
}else{
return false;
}
}
private boolean testSd(String interStorage) {
StatFs mStatFs = new StatFs(interStorage);
if (mStatFs.getBlockCount() > 0) {
return true;
} else {
return false;
}
}
判断手机有无外置sd卡
猜你喜欢
转载自blog.csdn.net/d_shaoshuai/article/details/51809647
今日推荐
周排行