Browsing Image Gallery With PhoneGap & Android - Clearly Innovative | Web and Mobile DevelopmentClearly Innovative | Web and Mobile Development

I am porting an application I wrote for the iphone over to Android and I wanted to start with the Camera functionality. I looked around and Googled and I could not find where it was documented on how to browse the image gallery on the Android device. I decided to bang out some simple modifications to the existing Camera object to support that functionality for now. I the future, hopefully this is implemented better by the PhoneGap guys and I can put this code out to pasture.

This code needs to be added to the phoneGap.js file. It creates the prototype for the new method for browsing the gallery on the device

This the modification I made to the CameraLauncher class provided by PhoneGap. Add a new intent to launch the image gallery

Also we need to handle the returned file. I left it simple, but this could be cleaned up a bit What I do is assume that if there is a URI in the data field, then an image has been picked and should be processed by the utility. In the beginning of the

add the code below. This will handle re-assigning the URI to the selected file

After a little more testing and code cleanup, I will make the complete project for the android work and the iphone work available. If there are any questions, post it below.