Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Crash on OptionDialog?

IGNORE THE THREAD TITLE. I FIXED THAT PROBLEM. NEW ONE BELOW.

Here is my code, does anybody see what is wrong? For some reason when I click "Save File" when the option pops up, the file is not saved to the Camera Roll/Gallery.

// Add a save button
var save = Titanium.UI.createButton({
    systemButton:Titanium.UI.iPhone.SystemIcon.DOWNLOADS
});

save.addEventListener('click', function() {
    var savedialog = Ti.UI.createOptionDialog({
        options:['Save File', 'Close'],
        cancel:1,
        title:'Would you like to save this image?'
    });
    savedialog.show();

    savedialog.addEventListener('click', function(e) {
        if (e.index == 0) {
            var file = Titanium.Filesystem.getFile('../images/promoshots/promo'+c+'.jpg');
            Titanium.Media.saveToPhotoGallery(file);
            Titanium.UI.createAlertDialog({title:'Image Saved',message:'This image has been succesfully saved to your photo gallery.'}).show();
        }
    });
});
— asked September 1st 2010 by Colton Arabsky
  • iphone
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.