java - onCreateOptionsMenu compile error -
i tried use oncreateoptionsmenu
in application. followed developers blog , didn't work of me.
when use code:
@override public boolean oncreateoptionsmenu(menu menu) { // inflate menu items use in action bar menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.homepage_actionbar, menu); return super.oncreateoptionsmenu(menu); }
i got compile errors:
multiple markers @ line - syntax error on token ")", ; expected - illegal modifier parameter oncreateoptionsmenu; final permitted - syntax error on token "(", ; expected multiple markers @ line - void methods cannot return value
my xml file:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/add_option" android:title="add item" android:icon="@drawable/ic_launcher" android:showasaction="ifroom" /> </menu>
thank helping
i assume oncreateoptionsmenu method implemented in method of activity.
just move @ "root" level of activity class.
Comments
Post a Comment