//Define the current window var myWin = Titanium.UI.currentWindow; //Define the button to activate camera var cameraBtn = Ti.UI.createButton({ title : 'Click to activate Camera', top : 10 //Set the button position on the screen }); cameraBtn.addEventListener('click', function(){ //Activate camera Titanium.Media.showCamera({ success : function(event) { //Holds the captured image var capturedImg= event.media; // Condition to check the selected media if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { //Define an image view with captured image var imgView = Titanium.UI.createImageView({ left : 10, width : 250, height : 250, image : capturedImg //Set captured image }); //Add the image to window for displaying myWin.add(imgView); } }, cancel : function() { //While cancellation of the process }, error : function(error) { // If any error occurs during the process } });