格式化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, "Can't get mount service"); } } return mMountService; } //format sdcard mMountService.formatMedia(Environment.getExternalStorageDirectory().toString()); //unmount sdcard mMountService.unmountMedia(Environment.getExternalStorageDirectory().toString());

你可能感兴趣的:(service,null)