March 2016
Intermediate to advanced
428 pages
9h 2m
English
Now that we've looked at the old Camera API, it's time to learn about the new Camera2 API. Unfortunately, it's a bit more complicated due to the asynchronous nature of the APIs. Fortunately, the overall concept is the same as the previous Camera API.
Create a new project in Android Studio and call it Camera2API. On the Target Android Devices dialog, select the Phone & Tablet option and chose API 21 (or higher) for the Minimum SDK. Select Empty Activity when prompted for Activity Type.
As you'll see, there's a lot of code for this recipe. Start by opening the Android Manifest and following these steps:
<uses-permission android:name="android.permission.CAMERA" ...
Read now
Unlock full access