赞
踩
try {
volume = new Volume();
volume.setPath((String) volumeList[i].getClass().getMethod(“getPath”).invoke(volumeList[i]));
volume.setRemovable((boolean) volumeList[i].getClass().getMethod(“isRemovable”).invoke(volumeList[i]));
volume.setState((String) volumeList[i].getClass().getMethod(“getState”).invoke(vol
《Android学习笔记总结+最新移动架构视频+大厂安卓面试真题+项目实战源码讲义》
【docs.qq.com/doc/DSkNLaERkbnFoS0ZF】 完整内容开源分享
umeList[i]));
list_storagevolume.add(volume);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
} else {
LogUtils.D(“null-------------------------------------”);
}
} catch (Exception e1) {
e1.printStackTrace();
}
return list_storagevolume;
}
/**
通过反射调用获取内置存储和外置sd卡根路径(通用)
@param mContext 上下文
@param is_removale 是否可移除,false返回内部存储,true返回外置sd卡
@return
*/
private static String getStoragePath(Context mContext, boolean is_removale) {
StorageManager mStorageManager = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE);
Class<?> storageVolumeClazz = null;
String path="";
try {
storageVolumeClazz = Class.forName(“android.o
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。