我正在尝试使用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。有没有办法解决这个问题,或者这是设备中的错误?