Reputation: 71
The code below allows you to invoke an intent to capture photos via Camera.
static final int REQUEST_IMAGE_CAPTURE = 1;
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
}
What I want to know is the code for Camera2? I already have my codes ready for the Camera2 intent, I just don't know how to redirect my button to it.
Upvotes: 1
Views: 614
Reputation: 1006574
The code below allows you to invoke an intent to capture photos via Camera.
No. That code starts the user's choice of camera app. That can be any one of dozens (if not hundreds) of pre-installed camera apps, or any one of dozens (if not hundreds) of user-installed camera apps.
What I want to know is the code for Camera2?
There is no Intent
for "Camera2".
There are Java classes in android.hardware.camera2.*
that offer a more direct API to the camera. Those are counterparts to android.hardware.Camera
, not ACTION_IMAGE_CAPTURE
.
Upvotes: 2