相机在Moto X中无法打开

时间:2018-05-02 09:57:31

标签: android android-intent android-camera

我正在尝试使用MediaStore.ACTION_IMAGE_CAPTURE在Moto X设备中打开相机。以下是代码:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);                intent.putExtra(MediaStore.EXTRA_OUTPUT, cameraUri);
if (intent.resolveActivity(context.getPackageManager()) != null) {
            TelloApplication.getInstance().setInBackgroundWithSafeMode(true);
            if (chooser) {
                context.startActivityForResult(
                        Intent.createChooser(intent, context.getString(R.string.perform_action_with)),
                        attachmentChoice);
            } else {
                context.startActivityForResult(intent, attachmentChoice);
            }
        }

问题是intent.ResolveActivity为null。有没有办法解决这个问题,或者这是设备中的错误?

0 个答案:

没有答案