Titanium Community Questions & Answer Archive

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

Library, helpers, toolkits, etc

Hello all,

With a great active Ti development community, I was wondering if anyone would be interested in sharing some common libraries, utility objects, etc. I'd love to get something started as I know everyone is probably doing the same thing over and over again in build great Ti apps. I would be interested in hearing some feedback on this front.

-James

— asked October 28th 2010 by James DeVries
  • framework
  • helper
  • toolkit
  • utility
0 Comments

4 Answers

  • Yes. I think it is a good idea and I have code that I would donate to the cause.

    — answered October 29th 2010 by John McKnight
    permalink
    0 Comments
  • sendEmail = function(subject, message) 
    {
        // email
       var emailDialog = Titanium.UI.createEmailDialog();
        if (!emailDialog.isSupported()) {
            Ti.UI.createAlertDialog({
                title:'Error',
                message:'Email not available'
            }).show();
            return;
        }
        emailDialog.setSubject(subject);
        //emailDialog.setToRecipients(['foo@yahoo.com']);
        //emailDialog.setCcRecipients(['bar@yahoo.com']);
        //emailDialog.setBccRecipients(['blah@yahoo.com']);
    
        if (Ti.Platform.name == 'iPhone OS') {
            emailDialog.setMessageBody(message);
            emailDialog.setHtml(true);
            emailDialog.setBarColor('#336699');
        } else {
            emailDialog.setMessageBody(message);
        }
    
    
        emailDialog.addEventListener('complete',function(e)
        {
            if (e.result == emailDialog.SENT)
            {
                if (Ti.Platform.osname != 'android') {
                    // android doesn't give us useful result codes.
                    // it anyway shows a toast.
                    Ti.UI.createAlertDialog({
                        title:'<APP TITLE>',
                        message:'Email successfully sent!'
                    }).show();
                }
            }
            else
            {
                if (e.result != 0) {
                    Ti.UI.createAlertDialog({
                        title:'Erro',
                        message:"The email has not been sent."
                    }).show();
                }
            }
        });
        emailDialog.open();
    
    
    };
    
    — answered May 15th 2011 by Rafael Cardoso
    permalink
    0 Comments
  • // Show error dialog.
    showError = function(msgText) {
        var statusAlert = Titanium.UI.createAlertDialog({title:"Error",message:msgText});
        statusAlert.show();
    };
    
    — answered May 15th 2011 by Rafael Cardoso
    permalink
    0 Comments
  • very interesting topic! well done, i will try to add something as well.

    — answered May 28th 2012 by Visuddha Karunarthne
    permalink
    0 Comments
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.