[英]Camera error cannot connect to the camera
我正在進行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
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,然后轉到“后置攝像頭”。
您還檢查喜歡
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
文件中添加Require Permision
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.