Taking pictures is all well and good, but what about when we wish to save an image to the filesystemso we can retrieve it again later? In this recipe we will do exactly that and also introduce you to the toImage()
method which is inbuilt in many of the Titanium controls. This method takes a flattened image of the entire view it is called upon and is extremely useful for taking screenshots or grabbing an image of many controls lumped together in a single view.
Type in the following code after your btnGetPhoto
object is created. You can replace the existing code that we've written to add the btnGetPhoto
object to the navigation bar, as this code repeats that code and also extends it.
//save a photo to file system button var btnSaveCurrentPhoto = Titanium.UI.createButton({ title: 'Save Photo', zIndex: 2 //this appears over top of other...