我无法创建2 onCreateContextMenu。 我正在接受此错误:"错误:(101,17)错误:方法onCreateContextMenu(ContextMenu,View,ContextMenuInfo)已在类MainActivity中定义" - 这是我的MainActivity.java 和 我如何使用2 onCreateContextMenu?
感谢您的帮助
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
if(v.getId()==R.id.button2); {
this.getMenuInflater().inflate(R.menu.color_context_menu,menu);
}
super.onCreateContextMenu(menu, v, menuInfo);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
if(v.getId()==R.id.button);{
this.getMenuInflater().inflate(R.menu.color_context_menu,menu);
}
super.onCreateContextMenu(menu, v, menuInfo);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}