javamethodsoverridingimplementationoncreateoptionsmenu

error: method does not override or implement a method from a supertype 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;
    }

I have a error message when i build on AndroidStudio : error: method does not override or implement a method from a supertype I need help


Solution

  • Those methods have a lower case '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; }