Android Menu not working no matter what I do, where am I going wrong?

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

I'm trying to attach a menu system to my windows, and I've tried every permutation of adding a menu to my windows that I can find through a google search and the Q&A area. Not sure what Im doing wrong for this to not work, but here is the code Im using.

(BTW Im using from the continuous builds)

var w = Titanium.UI.createWindow({
w.activity.onCreateOptionsMenu = function(e){
                                var menu =;
                                var m1 = menu.add({
                                        title: 'Home'
                                m1.addEventListener('singletap', function(e){
                                var m2 = menu.add({
                                        title: 'Activity Feed'
                                m2.addEventListener('singletap', function(e){

— asked 4 years ago by C H

4 Answers

Accepted Answer

This is a regression in which is unstable. Watch TIMOB-6359 to see when a fix comes available.


I am running your code beautifully. I am using 1.7.5 Android 2.3.6 Google APIs

Probably due to SDK version you use

Try this code :

// Associated directly with an activity
activity = Ti.Android.currentActivity;
activity.onCreateOptionsMenu = function(e) {
    var menu =;
    var menuItem = menu.add({ title: "Item 1" });
    menuItem.addEventListener("click", function(e) {
        // do something when the menu item is tapped
// or with your heavyweight window, set here with navBarHidden
var win = Titanium.UI.createWindow({
    navBarHidden: false,
    activity : {
        onCreateOptionsMenu : function(e) {
            var menu =;
            var menuItem = menu.add({ title : 'Item 1' });
            menuItem.addEventListener('click', function(e) {
                // do something when the menu item is tapped

and if u want to save memory and increase the efficiency of the application then u must try onPrepareOptionMenu, bcoz it works on the same object of onCreateOptionMenu.

Ive tried this for different views and different windows and it is working fine.

Your Answer

Think you can help? Login to answer this question!