I am following a beginners guide to android programming and I cannot get menuinflato开发者_开发问答r to import, I keep getting
the import android.view.MenuInflator cannot be resolved
Does this mean I need to add a package to eclipse or is my code wrong in some way? I would really like to continue with the tutorial but I cannot get the example working.
the code is below.
package test.menus;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflator;
public class TestMenusActivity 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)
{
MenuInflator inflator = getMenuInflator();
inflator.inflate(R.menu.mainmenu, menu);
return true;
}
}
You probably meant MenuInflatEr.
精彩评论