Skip to content

Instantly share code, notes, and snippets.

@gbaldera
Forked from pec1985/app.js
Created April 20, 2012 18:19
Show Gist options
  • Save gbaldera/2430838 to your computer and use it in GitHub Desktop.
Save gbaldera/2430838 to your computer and use it in GitHub Desktop.
Android Menu Example
var win = Ti.UI.createWindow({
exitOnClose: true,
backgroundColor: '#ccc',
fullscreen: false
});
win.open();
var activity = win.activity;
activity.onCreateOptionsMenu = function(e){
var menu = e.menu;
var btn1 = menu.add({title: 'Hello btn 1'});
btn1.setIcon(Ti.Android.R.drawable.ic_menu_camera);
var btn2 = menu.add({title: 'Hola btn2'});
btn2.setIcon(Ti.Android.R.drawable.ic_search_category_default);
btn1.addEventListener('click', function(){
alert('btn1');
});
btn2.addEventListener('click', function(){
alert('btn2');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment