选择菜单上的项目后,我正在尝试更改选项菜单。这是我尝试过的:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if(refresh) {
menu.clear();
menu.add(0, Menu.FIRST, 0, "Changed item");
}
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == R.id.refresh)
{
refresh = true;
closeOptionsMenu();
invalidateOptionsMenu();
openOptionsMenu();
}
return super.onOptionsItemSelected(item);
}
但我得到:
W/InputManagerService(192): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4147c778
并且代码不起作用..有什么想法吗?