Android Camera with Surfaceview - android

I want to built my own camera app in android including the following options pinch to zoom and autofocus without using camera intent. I already gone through some samples from Git hub but I couldn't make use of them.So, I decided to start learning Camera API from Google developers. Here I need a complete steps to develop my app and what to learn like camera, surface view and anything else.
Thanks in advance

I have done what you want to be done recently.
For android, there are 2 camera APIs
the camera api
and the camera2 api
camera api is deprecated on android api 21. starting from android api 21, you have to use camera2 api. so you have to learn both of them.
Camera api brother with SurfaceView.
Camera2 api brother with TextureView.
Camera2 api is quit alot different from Camera api, and also is much more complicated than Camera api.
You may want to take a look at my project SimpleCameraView, it is much clear than other projects. I just created this repository yesterday.

Things to Need to Learn to Build Custom Camera APP
Setting Camera,FlashLight and FILE_STORAGE Permissions in Manifest
SurfaceView and How to Use it.
Manual Control of Flash Light.
Lazy Loader for Displaying Images Taken without Memory Leaking.
And you can go through this for Sample : Build Custom Camera

Related

Unable to create a surfaceview camera app that supports android 4.0 and above.

I'm planning to make a camera app that you can take a photo with a background image.
I guess there will be a need to use a Surfaceview? But the main problem is since the Camera is deprecated
there might be a need to use camera2 for android. I want to make a camera app in portrait mode but are there any
samples or tip? I googled but wasn't able to find a decent one. I would love to hear from you.
If you want to start with Camera2 API, this link will help you understand basics.
android-Camera2Basic(Github)
It is not necessary to use SurfaceView as you will see from code
that TextureView can also fulfill your requirement
The HdrViewfinder sample app uses SurfaceView with camera2, though it doesn't lock itself into portrait mode. But that's a relatively simple change.
Of course, camera2 was only added in Android 5.0, so if you need to support 4.0, you need to use the old camera API.

Difference Between Camera and Camera2 in Android

I'm building an App which is similar to social media where people can share photos and videos like Instagram. That's why Camera is very important for my app. Now camera2 API is confusing me. I want to run my app on API level 11+ . I know camera2 is only available in API level 21+ So, I need to design two APIs one(camera) for older version and second(camera2) for higher version. Problem is that I just started to learn Android and I do not know what is the main difference between these two APIs.
What main features are available in Camera2 API ?
Or Is there any drawback of Old Camera API ?
I need three things in my App.
1- Simple capture photos
2- Burst pictures (To create GIF Image)
3- Simple video recording.
Which Camera API is good for me ?
The old camera API will work fine for #1 and #3; if you're OK with video-resolution GIFs, you can do #2 as well.
You'll need camera2 (and then devices that support fast, full-resolution capture - see the BURST_CAPTURE capability, or any device that supports the FULL hardware level.), if you want bursts at resolutions above ~1080p.
You can probably start with the CameraView unofficial support library, and modify it as needed. It has support for both APIs, selected based on API level of the device.

Complete Custom Camera2 example

I need to create a custom camera in Android that supports both higher and lower version.I am new to android.I have research a lot I have the code ready for hardware camera i.e. for the api less than 21.But I am finding hard time searching the code that supports camera hardware 2.
The old deprecated camera API still works on Android 21 and above. But you are right, using the new API is preferable, and gives you more options and better performance.
You can start with the official Camera2Basic sample.

Android SurfaceView or Camera2 API for camera preview

I am trying to implement the camera preview function into my app. After a lot of research I found that the best solution is the Camera2 API, but, it isn't supported on most phones. Is there a better solution to do this? For example, I read a lot about using a SurfaceView to load the camera preview on.
I simply followed the Android docs to use the camera API. Camera2 API is fairly new and I want to make sure all users can have it.

Which Android Camera API should a new project use?

I am developing a new app, and I want to support all the way back to Jelly Bean/Ice Cream Sandwich. I need to use the video camera in my app - just to shoot some 15 second footage and no processing.
Do I have to write two camera Activities, one with the camera api and the other with the camera2 api, and somehow pick one based on the api level of the device?
Or, should I just use the camera api?
Which camera api would you use if you were developing a new camera based app today?
Thanks!
Mark
For the near future, the deprecated Camera API will not disappear, even on the cutting-edge new devices. I would recommend to switch to Camera2 if one of the following causes applies:
your app makes good use of some of the new features, e.g. capture-while-recording.
your app has other reasons not to be backwards-compatible under API v.21 (Lollipop), e.g. it only runs on ARM64.
you want to practice or demonstrate your skills with the new API.
PS and I support the first suggestion from SAg: use the Camera Intent if you only need what such intent can provide. A short unprocessed video clip is a good example.
First of all, you need to decide whether you really want to build a customized camera app, or you can use an existing camera app. From your question, I feel that yours is the latter case, and you can simply use an intent to invoke an existing Android camera application.
https://developer.android.com/guide/topics/media/camera.html#intents
If you really want to build your own customized camera app, I suggest that you refer this link:
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
And read the following sections:
Application forward compatibility
Application backward compatibility
Selecting a platform version and API Level

Categories

Resources