假坚强 发表于 2013-8-28 16:30

格式化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]
查看完整版本: 格式化SD卡/卸载SD卡