Android camera button - java

I am writing a simple android camera application (SDK version 7). Can I handle camera button like in native camera app, i.e. soft click - focus, and hard click - capture photo ?

Be aware that many android devices do not have physical camera button. It is safer bet to allow the way for the users to use touch screen for both focusing and taking photo.
Anyway, since you mention native camera app, I assume you mean the official camera app. In that case, you can find the source code at https://android.googlesource.com/platform/packages/apps/Camera.git

Related

How can I open a user's camera and have it open, but NOT to take a photo on Android Studio

I want to open the camera but not in photo form so I can add an overlay. I just need the camera to display what is shows but not to take the photo if that makes sense... How can I do this?
maybe this article help you open camera view in your app by creating your own view and open camera in its own different thread ,
as it might take time to load and this will result in the lagging UI.
Maybe this article from android developers website will help you achieve what you want.
https://developer.android.com/training/camera/cameradirect#kotlin

MediaStore.ACTION_VIDEO_CAPTURE crashes camera app if device is portrait

I'm using a standard MediaStore.ACTION_VIDEO_CAPTURE Intent call (e.g. the one on the Developer site or lots of StackOverflow threads) to record some video. I'm testing it on a (real) Nexus 7 (API 21) and it works fine...so long as the device's display is in a landscape orientation when the (native) Android camera app starts up. If it is portrait, reverse-portrait or reverse-landscape, the camera app stops part way through its initialization ("Unfortunately, Camera has stopped") and control returns to my app. The camera app is happy to reorient to portrait once it has initialized in landscape, however. And if I use MediaStore.ACTION_IMAGE_CAPTURE, it'll start in portrait or landscape.
I know that I can fix the orientation of my app to landscape and I know that I can request the camera to record in landscape, but if the user happens to be holding the device in portrait anyway, the screen rotates to vertical during the transition, as my app releases control to the camera app. The camera app then receives control while the orientation is portrait and it doesn't like it and stops. The issue is not due to a change of orientation -- even if I keep everything locked to portrait throughout, the camera app cancels part-way through its initialization routine.
Is there a way to avoid this happening (while still using the camera via Intent)?
(PS I notice from here, about bespoke camera routines: "Note: A camera preview does not have to be in landscape mode..." and goes on to explain how to make that happen. Does that mean that the "Intent" implementation does?)
Is there a way to avoid this happening (while still using the camera via Intent)?
No.
More specifically, there are thousands of possible camera apps -- preloaded or installed by users -- that could claim to support ACTION_VIDEO_CAPTURE, and any of them can have bugs as this one does. There is no EXTRA_PLEASE_AVOID_BUGS that you can pass on the Intent to change that (though that'd be really cool...).

Android Galaxy Camera invoke camera app for continuous shot

I'm using the first method outlined in this answer (https://stackoverflow.com/a/10229228) to invoke the camera app to let the user take a photo and return it to my app. What I want to do is get a series of photos from continuous (burst) shot mode, but invoking the camera app in this way only allows the user to take a single photo.
I have tried adding code to my app to use the camera directly with autofocus set to infinity however it doesn't get anywhere near the performance of continuous shot mode.
Is there something I can add to the intent I'm starting to tell it to use a different mode?

Set android camera to send gray scale images

Can the android camera be programmatically set to send gray scale images.
I'm not asking about conversion after the images have been received, I'm asking for a way to programmatically set it like we do with fps, resolution etc.
Are you talking about the built in camera app (via an intent) or inside your app?
If it's the built in camera app, i don't think it's possible, and even if it was , you can't assume it will work the same on all devices, since many of them have customized camera apps.
About camera within your app, yes, you can do it, and there are examples out there how to do show things on the camera based on its content , like this one

Using the Camera in my app.

I've tried to start the camera and use it my app - with unsatisfactory results. I followed the sample code provided in the android SDK (the Preview class), and I got bad results - the camera was rotating and when I tried to add a button, it never showed up.
I checked other apps and it looks like the skype app uses the same camera app as the one built into the phone. I want to know how I can implement this in my own app. Any solutions?

Categories