How to add more menu buttons to android window menu

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

Say I have a window like so

var win = Ti.UI.createWindow({
        title : 'SSSSS',
        layout: 'vertical',
        activity: {
                onCreateOptionsMenu : function(e) {
                    var m1 = e.menu.add({ title : 'Logout' });
                    m1.addEventListener('click', function(e) {
                        app.user.logout();
                    });
                }
            }
    });
then later in code I want to add more menu items into menu. How do I go about doing it?

1 Answer

Accepted Answer

— answered 9 months ago by Aaron Saunders
answer permalink
3 Comments
  • Thanks. I read the manual and looked at the API. Those methods do not really work or I just cant figure out how to make them do what I want. I am able to replace the menu but I cannot seem to just add more items in the menu.

    — commented 9 months ago by Mike Starov

  • Actually it worked. I was able to modify the menu using that method.

    windowToOpen.activity.onPrepareOptionsMenu = function(e){
                    var m1 = e.menu.add({ title :'New Button'});
                    m1.addEventListener('click', function(e) {
                        // code here
                    });
     
                }

    — commented 9 months ago by Mike Starov

  • glad it worked out for you.

    — commented 9 months ago by Aaron Saunders

Your Answer

Think you can help? Login to answer this question!