Can I call camera using Intent, if yes then what is the difference between intent and Camera? cam = Camera.open(); I write above code but I get an error. How can I solve this error?
Of course yes.
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
You will get data onActivityResult
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
}
add the following feature in the Manifest.
**<uses-feature android:name="android.hardware.camera"/>**
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With