Friday 2 August 2013

Text Field In ALERT BOX in Android in APPCELERATOR

Below is Simple code for TextField in ALERT BOX. 



app.js

//Helpful code :)

var win = Titanium.UI.createWindow({
    backgroundColor:'#fff'
});

var textfield = Ti.UI.createTextField({
    value : 'Hello :)'
});

var dialog = Ti.UI.createAlertDialog({
    title: 'Enter text',
    androidView: textfield,
    buttonNames: ['OK', 'cancel']
});
dialog.addEventListener('click', function(e){
    Ti.API.info(textfield.value);
});
dialog.show();

win.open();

Snap :)


No comments:

Post a Comment