Quantcast
Viewing all articles
Browse latest Browse all 8068

Alert Dialog with an Image

Id like to create an alert dialog after a user selects an image from the photo gallery so that the user can confirm the image they want to use. Is there a way to add an image to a popup dialog for iOS.

This is what I have now but I haven't found a way to get a confirmation from the user on the image

function openPhotoGal() {
 
    Ti.Media.openPhotoGallery({     
 
        autoHide: true,
        mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO],
        success: function(e) {
 
            //ideally the image would be in this custom dialog
            var confirmDialog = Titanium.UI.createAlertDialog({
                message : "Is that the image you would like to use?",
                buttonNames : ['Yes', 'No']
            }); 
 
            //But this is also acceptable
            // though I haven't been able to get the image to show
            alert(e.media);
            confirmDialog.show();
            confirmDialog.addEventListener('click', function(e) {       
                if (e.index == 1) {
                    //discard image
                }
                if (e.index == 0) {
                    //keep image
                }
            });
        }
    });
}
Does anyone have thoughts on how I could accomplish this without having to create my own custom popup window view?

Viewing all articles
Browse latest Browse all 8068

Trending Articles