/ThreadPoolWithCameraPreview

Demo of using threadpools to improve performance on Android

Primary LanguageJava

ThreadPool with Camera Preview

Download the demo app on Google Play.

This project demonstrate how to use HandlerThreads and ThreadPools to burst capture images from Android's Camera API on a background thread. The images are then:

  • Converted from YUV byte[] to RGB int[].
  • Converted from RGB int[] to Bitmap.
  • Bitmap is rotated if needed to fix orientation.
  • A Thumbnail size Bitmap is made for displaying.
  • Full size bitmap is written to disk as a Jpeg.
  • Jpeg image is uploaded to a server.

The CameraPreview YUV byte[] is captured on a background HandlerThread and then ThreadPools are used to perform the operations above to improve speed and performance.

Performance Before TheadPool

Performance before ThreadPool

Performance After ThreadPool

Performance after ThreadPool

Demo App on Google Play

Download the demo app on Google Play.