格式化SD卡/卸载SD卡
6格式化SD卡/卸载SD卡private IMountService mMountService;
mMountService = getMountService();
private synchronized IMountService getMountService() {
if (mMountService == null) {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
mMountService = IMountService.Stub.asInterface(service);
} else {
Log.e(TAG, "Cant get mount service");
}
}
return mMountService;
}
//format sdcard
mMountService.formatMedia(Environment.getExternalStorageDirectory().toString());
//unmount sdcard
mMountService.unmountMedia(Environment.getExternalStorageDirectory().toString());
页:
[1]