May 2022
Intermediate to advanced
688 pages
20h 12m
English
You are successfully taking pictures, and your image will be saved to a file on the filesystem for you to use.
Your next step is to take this file, load it, and show it to the user. To do this, you need to load it into a reasonably sized Bitmap object. To get a Bitmap from a file, all you need to do is use the BitmapFactory class:
val bitmap = BitmapFactory.decodeFile(photoFile.getPath())
There has to be a catch, right? Otherwise we would have put that in bold, you would have typed it in, and you would be done.
Here is the catch: When we say “reasonably sized,” we mean it. A Bitmap is a simple object that stores literal pixel data. That means that even if the original file were compressed, there ...
Read now
Unlock full access