Scaling and Displaying Bitmaps

With that, you are successfully taking pictures. Your image will be saved to a file on the filesystem for you to use.

Your next step will be to take this file, load it up, 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:

B​i​t​m​a​p​ ​b​i​t​m​a​p​ ​=​ ​B​i​t​m​a​p​F​a​c​t​o​r​y​.​d​e​c​o​d​e​F​i​l​e​(​m​P​h​o​t​o​F​i​l​e​.​g​e​t​P​a​t​h​(​)​)​;​

There has to be a catch, though, 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 ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.