CameraX: Getting Started

Learn how to create a camera app with the recently announced CameraX API for Android, which allows you to easily implement previews and real-time image analysis. By Aldo Olivares.

4 (9) · 1 Review

Save for later

Who is this for?

This course is intended for Advanced Android developers who are interested in migrating from the old Camera2 APIs. This course expects you to be familiar with Android Studio, Android Development with Kotlin and to have experience with file management and runtime permissions. Familiarity with the Camera2 API is recommended but not required.

Covered concepts

  • Adding permissions to the Android manifest
  • Requesting runtime permissions for the camera.
  • Preview use case with a TextureView
  • Image Capture use case
  • Image Analysis use case

Part 1: Work with CameraX

Toggle description

Learn what CameraX is and how it makes your app development easier by providing an easy to use API that works consistently across different devices with different manufacturers.

Toggle description

In this episode, you'll add CameraX dependencies and learn how to request permissions at runtime.

Toggle description

TextureView allows you to display a preview. Learn how to configure your TextureView to listen for changes in your device's orientation.

Toggle description

In this episode, learn how to display a preview of the picture you will take by creating a preview use case.

Toggle description

Learn how to give your users the power of choosing which camera they want to use to take a picture: front or back.

Toggle description

A camera app is only useful if it can take pictures. Learn how to take pictures with the camera and save them to local storage.

Toggle description

Learn how to configure the flash to turn it on or off according to the user's actions.

Part 2: Work with the Image Analyzer

Toggle description

Create a class that extends from ImageAnalysis.Analyzer and will display the average luminosity of a picture.

Toggle description

One of the most interesting features of CameraX is the ability to implement an image analyzer which allows you to analyze images using frameworks such as Firebase. Here, learn to create a Firebase project to use in your app.

Toggle description

Learn how to create a class that extends from ImageAnalysis.Analyzer and will display the raw value of your QR code.