Android toast notification in iPhone?

You must Login before you can answer or comment on any questions.

Is there a way to get this kind of communique in iPhone using titanium?

2 Answers

Accepted Answer

You can create a view with a label like Christian said. This function shows a message (customMessage) for n (interval) miliseconds and then self closes.

showMessageTimeout = function(customMessage,interval){
        // window container
        indWin = Titanium.UI.createWindow();
 
        //  view
        var indView = Titanium.UI.createView({height:150,width:250,borderRadius:10,backgroundColor:'#aaa',opacity:.7});
 
        indWin.add(indView);
 
        // message
        var message = Titanium.UI.createLabel({
            text: customMessage && typeof(customMessage!=='undefined') ? customMessage : L('please_wait'),
            color:'#fff',width:'auto',height:'auto',textAlign:'center',
            font:{fontFamily:'Helvetica Neue', fontSize:12,fontWeight:'bold'}});
 
        indView.add(message);
        indWin.open();
 
        interval = interval ? interval : 3000;
        setTimeout(function(){
            indWin.close({opacity:0,duration:1000});
        },interval);
    }

There is no toast notification equivalent on on iPhone, since it is Android specific.

You could, of course, reproduce the same behavior on iPhone using a view (with a label inside for the message) that is shown at the bottom of the screen with a fade-out animation after a few seconds.

Hope this helps.

Your Answer

This question has been locked and cannot accept new answers.