Android Question CameraEx - problem with rotation

DarkoT

Active Member
Licensed User
Hello, please help.
I've created a simple application for the company where users are supposed to take pictures of products via their phones, and the system would upload them via FTP to the appropriate work order.
I'm using the CameraEx library, but I'm facing an issue, or perhaps I can't find the right idea.
The app should work in portrait mode (using B4X pages), but only one page ("camera page") should be left to the user's decision (whether they rotate the phone in portrait or landscape). Question:
1. How can I then rotate only that page according to the phone's rotation?
2. It possible to set up the camera to rotate according the phone rotation?
I always want to capture the image in a 4:3 format. I'm attaching some images to help you visualize. If necessary, I can also add the code...

2024-04-08_08h22_43.jpg
2024-04-08_08h22_57.jpg


Thank you for your help.
 
Solution
Hi... sorry, maybe I haven't explained it well. What I mean is you can use that example on how using a normal activity (what you can rotate) with a B4XPages app.
Now you should add a new activity to your app, the way Erel explains in the example I posted, and add CameraEX to that activity.


You can't rotate the screen in a B4XPages app (at least without some workarounds).


Another option is using the system camera.

Okay, I understand... The system camera is working too slowly :) (users are not too happy when they need to wait 2 seconds :)) ... Just a question... When I switch back from B4XPages and use standard B4A logic with more...

josejad

Expert
Licensed User
Longtime User
Hi:

Try this approach and put the camera code in the exoplayer activity.

 
Upvote 0

DarkoT

Active Member
Licensed User
Hi:

Try this approach and put the camera code in the exoplayer activity.

Hi, thank you for suggestion... Can you (if you have) show me with example? I don't see the connection on how to capture a photo via ExPlayer... I probably don't understand it correctly... Maybe you can help me in a different way - I would like to capture a photo in a 'quick' manner - this is how CameraExClass works and everything is fine in principle - except that the system refuses to display the preview and switch the camera to full screen when the phone rotates... Do you have any idea how to solve this?
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
I don't see the connection on how to capture a photo via ExPlayer
Hi... sorry, maybe I haven't explained it well. What I mean is you can use that example on how using a normal activity (what you can rotate) with a B4XPages app.
Now you should add a new activity to your app, the way Erel explains in the example I posted, and add CameraEX to that activity.

the system refuses to display the preview and switch the camera to full screen when the phone rotates
You can't rotate the screen in a B4XPages app (at least without some workarounds).


Another option is using the system camera.

 
Upvote 0

DarkoT

Active Member
Licensed User
Hi... sorry, maybe I haven't explained it well. What I mean is you can use that example on how using a normal activity (what you can rotate) with a B4XPages app.
Now you should add a new activity to your app, the way Erel explains in the example I posted, and add CameraEX to that activity.


You can't rotate the screen in a B4XPages app (at least without some workarounds).


Another option is using the system camera.

Okay, I understand... The system camera is working too slowly :) (users are not too happy when they need to wait 2 seconds :)) ... Just a question... When I switch back from B4XPages and use standard B4A logic with more layouts, can I have one layout in portrait mode and another in landscape? This might fix my problem (maybe).....
 
Upvote 0
Solution

josejad

Expert
Licensed User
Longtime User
and use standard B4A logic with more layouts, can I have one layout in portrait mode and another in landscape? This might fix my problem (maybe).....
Yes, you can have the standard Android activities logic in the activity for the camera (rotation, different layouts in portrait or landscape...); and the standard logic in the B4XPages part of your app, with their advantages.
 
Upvote 0
Top