Android Question Selecting camera on phones with multiple main cameras.

MFX

Member
Licensed User
Longtime User
Many newer phones have multiple main cameras, E.G the Samsung S10 has a normal camera, Wide angle and telephoto as three separate camera modules. Is there a way in B4A to select which camera module to use?
 

walterf25

Expert
Licensed User
Longtime User
Many newer phones have multiple main cameras, E.G the Samsung S10 has a normal camera, Wide angle and telephoto as three separate camera modules. Is there a way in B4A to select which camera module to use?
The Camera Ids for multiple camera devices is 0, 1 and 2.

The Camera2 library will be useful
I had to change the Class Initialize method a bit to be able to pass the camera Id and iterate through any of the cameras.

You can check the Camera2 class here.

Let me know if you need any help with it.

Walter
 
Upvote 0

HappyDad

Member
Licensed User
Longtime User
The Camera Ids for multiple camera devices is 0, 1 and 2.

The Camera2 library will be useful
I had to change the Class Initialize method a bit to be able to pass the camera Id and iterate through any of the cameras.

You can check the Camera2 class here.

Let me know if you need any help with it.

Walter

I am having the same issue.
How do I modify the Camera2 class?
I see the following line in CamEX2,
B4X:
Public Sub OpenCamera (Front As Boolean) As ResumableSub
I can change this Front type to Int, so that I can pass 1 or 2 to OpenCamera.
But then, the FindCameraId in Camera2 needs a Boolean parameter.
 
Upvote 0
Top