Hi guys i want to create 3 dot action bar menu at fragment level, the condition is i want to show that menu at just 1 fragment not on all and if i make them at my main activity, Then i can't hide them so that's why i need to make them at fragment level. so, far i have tried this code on my fragment
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getActivity().getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// toggle nav drawer on selecting action bar app icon/title
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
switch (item.getItemId()) {
case R.id.sync:
Toast.makeText(this, "Sync data...", Toast.LENGTH_SHORT).show();
return true;
}
return super.onOptionsItemSelected(item);
}
But its saying the method "onCreateOptionsMenu" doesn't override from its super class.
It look like I'm miss something very basic, don't know what it is.
Thanks