jQuery in Action, 3rd edition
The moose likes Android and the fly likes Problem with onCreateOptionsMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Problem with onCreateOptionsMenu" Watch "Problem with onCreateOptionsMenu" New topic

Problem with onCreateOptionsMenu

Grigoriy Gusarov

Joined: Jan 10, 2013
Posts: 1
Hello all.

I need to ovveride method onCreateOptionmenu, but i can`t find it in "override/implement methods".

My code:
package com.gusarov.menu;

import android.os.Bundle;
import android.app.Activity;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

protected void onCreate(Bundle savedInstanceState) {

public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;


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

[Thumbnail for Безымянный.png]

Steve Luke

Joined: Jan 28, 2003
Posts: 4181

I don't know what the IDE is doing, but you can see the method here:

And it indicates it existed since API level 1, so no chance of having too old a version...

Steve Luke

Joined: Jan 28, 2003
Posts: 4181

Just played with Eclipse: looks like the IDE removes the method from the list of methods to insert/override if you have already inserted/overriden it. So since your Activity already has the boolean onCreateOptionsMenu(Menu) method, that method is removed from the list.
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with onCreateOptionsMenu
It's not a secret anymore!