My code is as follows:
package chapter.seven;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
public class UserInterface extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public boolean onCreateOptionsMenu(Menu menu)
{
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mainmenu, menu);
return true;
}
}
when I run it through the emulator, I keep getting the following error:
Class File Editor
Source Not Found!
The source attachment does not contain the source for the file MenuInflater.class
You can change the source attachment by clicking change Attached Source below:
I don’t understand why it cannot find the MenuInflater.class. I have looked all over the internet and cannot find a solution. Please help!
i think you need to call super.(super.onCreateOptionsMenu(menu);)