0

MtpDevice.importFile(int objectHandle, String destPath)在 4.4 及更高版本上失败。有没有办法从带有 SD 卡写锁的 MtpDevice 导入?

4

1 回答 1

0

暂时这就是我正在做的事情,虽然我很想避免双重转移:

            // KitKat and higher require the extra step of importing to the cache then moving
            if (Util.hasKitkat())
            {
                File tmp = new File(getExternalCacheDir(), name);
                mMtpDevice.importFile(objectHandle, tmp.getPath());
                success = FileUtil.moveFile(CameraImportActivity.this, tmp, endFile);
            }
            else
            {
                success = mMtpDevice.importFile(objectHandle, endFile.getPath());
            }
于 2015-08-18T00:07:49.757 回答