Skip to content

alphamu/ThreadPoolWithCameraPreview

Repository files navigation

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.

About

Demo of using threadpools to improve performance on Android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published