Reputation: 950
I am creating an app where the user has to take multiple pictures of an object. I need to guide him through the process by adding a message on top of the screen when the camera is opened (something like: Right side, Left side, Front, etc) Toasts are not good since I need the message to say there until the picture is taken. Is there a way to add a layout over the default camera? I considered creating a camera activity but with android.hardware.Camera
deprecated, and my minimum SDK not supporting camera2, it seems quite the predicament.
Any suggestion is appreciated.
Thank you
Upvotes: 0
Views: 531
Reputation: 1006614
Is there a way to add a layout over the default camera?
There is no single "default camera". There are several thousand Android device models. There are hundreds of different camera apps that come pre-installed on those device models. Plus, the user may elect to use a different camera app, one that they installed, when you try starting an ACTION_IMAGE_CAPTURE
activity (or however you plan on taking a picture). As a result, you have no way of knowing what the UI is of the camera activity to be able to annotate it, even if annotating it were practical (which, on the whole, it isn't).
I considered creating a camera activity but with android.hardware.Camera deprecated, and my minimum SDK not supporting camera2, it seems quite the predicament.
In Android, "deprecated" means "we have something else that we think that you should use". Unless the documentation specifically states that the deprecated stuff does not work starting with such-and-so API level, the deprecated APIs still work. They may not be the best choice, in light of the alternative, but they still work.
In particular, deprecated APIs sometimes are your only option. The camera is a great example. android.hardware.Camera
is the only way to take pictures on Android 4.4 and below. At the present time, that still represents the better part of a billion devices. Here, "deprecated" means "on Android 5.0 and higher, you should consider using android.hardware.camera2
". Whether you choose to use both APIs (android.hardware.camera2
on API Level 21+ and android.hardware.Camera
before then), or whether you choose to use android.hardware.Camera
across the board, is your decision to make.
If you want to offer some sort of guided picture-taking, implementing your own camera UI in your own app is pretty much your only choice.
Upvotes: 2