0

我正在努力camera activity捕捉image,在调用相机活动时它显示Camera错误无法连接camera请任何人都可以解释这个错误

我叫这个

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, TAKE_IMAGE);

错误信息:

camera error
cannot connect to the camera
4

2 回答 2

0

你也检查喜欢

    PackageManager pm = getPackageManager();
    if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
      // your Intent Goes Here Like
        Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        i.putExtra(MediaStore.EXTRA_OUTPUT,MyFileContentProvider.CONTENT_URI);
        startActivityForResult(i, CAMERA_RESULT);
    } else {   
        UtilityCommon.showDialogwithTitle(context,context.getResources().getString(R.string.strvalidcamera));               

    }

还要在您的AndroidMAnifest.xml文件中添加要求权限

于 2013-04-17T06:24:00.710 回答
0
add permission in your manifest file

<uses-feature
    android:name="android.hardware.camera" />
<uses-feature
    android:name="android.hardware.camera.autofocus" />

<uses-permission
    android:name="android.permission.CAMERA"></uses-permission>

如果仍然无法正常工作,则编辑 AVD 并转到选定的后置摄像头模拟

于 2013-04-17T06:18:53.687 回答