Android Capturing Images from Camera or Gallery as Bitmaps

Hamza Asif
5 min readMar 6, 2021
Photo by Eaters Collective on Unsplash

Capturing images using a camera and using it in your Android applications can be tricky at times but the process is quite simple.

So in this story, I will teach you to get images from the gallery or capture images using a camera and then getting those images as bitmaps in our applications.

Note: Learn the use of machine learning and computer vision in Android, Flutter & React Native with our Mobile Machine Learning courses. You can avail discount on the following Android machine-learning courses

  1. Train Object Detection Models for Android — The 2024 Guide
  2. Android & Google Gemini — Build Smart Android Kotlin Apps
  3. Face Recognition and Detection in Android- The 2024 Guide
  4. Android ML — Train Tensorflow Lite Models for Android Apps
  5. ChatGPT & Android — Build Chatbots & Smart Apps for Android
  6. Machine Learning use in Android — The 2024 Guide

So lets’ Start

So firstly create a new Android studio project and select Java as the programming language. For Kotlin click here.

Layout

Now in the activity_main.xml file place an ImageView widget

--

--

Hamza Asif

Udemy Instructor, Flutter Dev helping people Integrate ML & AI in Mobile Apps . Visit my courses https://www.udemy.com/user/e1c14fb5-1c9b-45ef-a479-bbc543e33254