Android development is becoming easy to jump in day by day. There are so many convenient development tools such as Jetpack. However, when it comes to Camera2, there’s still a big hurdle for new comers to understand the whole picture of how it works. Also I should note that even famous Android books or the official doc do not explain a lot about Camera2 API, especially how we should implement.
While working on the next Snapp Mobile internal project I ran into a small Gem of the Android Framework I’ve not known about before even though it’s been there since API 1. It might be that I’m the last one to learn about the usefulness of this class in modern UIs but in the off chance that I’m not I thought I’d share a quick example how this small utility made my life easier.
If you’re anything like me a few months ago, you’ve hit a breaking point. You’re feeling something akin to desperation and you don’t know what to do. You’ve already tried all the classic tricks like fiddling with JVM args and Gradle properties, but to no avail. I’m going to show you how to actually improve your build performance through rigorous analysis and testing. That means I’m not going to throw random hacks at you for copypastaing — if you were hoping for a quick fix, dry up your tears and buckle up, ‘cause we’re about to get into the nitty-gritty by analysing your build to find the bottlenecks.
A single Android device can have multiple cameras. Each camera is a CameraDevice, and a CameraDevice can output multiple streams simultaneously. Why would we do that? Well, one stream might be optimized for a specific use-case, such as displaying a viewfinder, while others might be used to take a photo or make a video recording.