Snap and Save Pictures
To snap pictures and save them to the external storage of our device, we’ll first need to add a savePhoto method to the previous sketch here. The method takes care of capturing the image and writing it to the device’s external storage in a folder that bears the app’s name. When the photo is written to this public directory on the SD card, we receive a callback from onSavePhotoEvent notifying us that the writing process is complete. This callback method is also useful if we’d like to notify the device’s media library to make the photos available to other applications, which we accomplish with a call to the addToMediaLibrary method. Once we’ve added photos to the media library, we can browse them in the Gallery—Android’s ...
Get Rapid Android Development 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.