Android Menu

edited October 2013 in Android Mode

Has anyone figured out how to make a drop down menu for android? Using Processing 2.0.1

Answers

  • edited October 2013

    Do you mean a menu from pressing the menu button on the phone? or a custom gui element that you would build from scratch?

    If it's the former, check here: http://developer.android.com/guide/topics/ui/menus.html

    it looks like there are two methods you can override to both add a menu and react to a menu selection:

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            MenuInflater inflater = getMenuInflater();
            inflater.inflate(R.menu.game_menu, menu);
            return true;
        }
    

    and to react to an option selection:

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
            // Handle item selection
            switch (item.getItemId()) {
                case R.id.new_game:
                    newGame();
                    return true;
                case R.id.help:
                    showHelp();
                    return true;
                default:
                    return super.onOptionsItemSelected(item);
            }
        }
    

    Hope this helps! ak

  • Not sure where the link came from, should just be @Override

  • aah, it's trying to mention someone named Override :) That would be a cool name...

Sign In or Register to comment.