错误:方法未覆盖或从超类型OnCreateOptionsMenu实现方法

时间:2019-01-06 17:49:44

标签: java methods override implementation oncreateoptionsmenu

@Override
public boolean OnCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu, menu);
    return true;
}

@Override
public boolean OnOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()){

        case R.id.logout:
            FirebaseAuth.getInstance().signOut();
            startActivity(new Intent(MainActivity.this, StartActivity.class));
            finish();
            return true;
    }

当我在AndroidStudio上构建时,我收到一条错误消息:error:方法未覆盖或从超类型实现方法 我需要帮助

1 个答案:

答案 0 :(得分:0)

这些方法的小写字母'o'

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
getMenuInflater().inflate(R.menu.menu, menu); return true; } 


@Override 
public boolean onOptionsItemSelected(MenuItem item) {
 switch (item.getItemId()){ 
case R.id.logout:
 FirebaseAuth.getInstance().signOut();
 startActivity(new Intent(MainActivity.this, StartActivity.class)); finish(); return true; }