Titanium.UI.Android.OptionMenu

submodule of Titanium.UI.Android
   
1.1

The menu that appears at the lower portion of the display when the device's Menu button is pressed.

Objects

Name Description
Titanium.UI.Android.OptionMenu.Menu

A Menu allows you to provide a selection of options that appear when the menu button is pressed on device. The Menu is created by the method Titanium.UI.Android.OptionMenu.createMenu

Titanium.UI.Android.OptionMenu.MenuItem

A MenuItem allows you provide a selectable option with a graphic and titel. The Menu Item is created by the method Titanium.UI.Android.OptionMenu.createMenuItem

Methods

Name Description
addEventListener add an event listener for the instance to receive view triggered events
createMenu create and return an instance of Titanium.UI.Android.OptionMenu.Menu
createMenuItem create and return an instance of Titanium.UI.Android.OptionMenu.MenuItem
fireEvent fire a synthesized event to the views listener
removeEventListener remove a previously added event listener

Properties

Name Type Description
menu object

The Titanium.UI.Android.OptionMenu.Menu for this context.

Events

This module has no events

Code Examples

Menu

var menu = Titanium.UI.Android.OptionMenu.createMenu();
 
var item1 = Titanium.UI.Android.OptionMenu.createMenuItem({
    title : 'Item 1',
    icon : '/images/item1.png'
});
 
item1.addEventListener('click', function(){
    Ti.UI.createAlertDialog({ title : 'You clicked Item 1'}).show();
});
 
var item2 = Titanium.UI.Android.OptionMenu.createMenuItem({
    title : 'Refresh',
    icon : '/images/refresh.png'
});
item2.addEventListener('click', function(){
    Ti.UI.createAlertDialog({ title : 'You clicked Refresh'}).show();
});
 
menu.add(item1);
menu.add(item2);
 
// Set the menu on the current heavyweight window. A heavyweight window maps to an Android
// Activity. To create a heavyweight window, specify one or more of [**fullscreen**,**navBarHidden**,**modal**] to createWindow.
 
Titanium.UI.Android.OptionMenu.setMenu(menu);