android - Camera Preview is displaying a black screen -
protected void onresume() { super.onresume(); log.d("onresume", "camera has been resumed"); try { mcamera = camera.open(); log.d("onresume", "camera has been opened"); mcamera.startpreview(); log.d("onresume", "camera has started preview"); preview.setcamera(mcamera); log.d("onresume", "setcamera"); } catch (runtimeexception ex) { log.d("onresume", ex.getmessage()); } }
getting error while mcamera=camera.open() called.it not able connect camera services. inspit of using permission in manifest file.
error while opening camera , camera services d/onresume﹕ camera has been resumed. w/camerabase﹕ error occurred while connecting camera: 0. d/onresume﹕ fail connect camera service getting error in inside try block. have used camera permission in manifest file.
error self hint problem,your missing add camera permission in androidmanifest.xml :
<uses-permission android:name="android.permission.camera" />
also add uses-feature if required :
<uses-feature android:name="android.hardware.camera" android:required="false" />
Comments
Post a Comment