Two days ago, I switched switched from xamarin to android studio and I'm extremly new to Java. I'm trying to create a DrawerLayout
with a NavigationView
but once I try to override onOptionsItemSelected
it simply don't wanna come. So what should I do? I tried to paste a method, but android studio treats it as a normal variable or method.
Edit : Solved.
onCreateOptionsMenu()
is a method like onCreate()
. You have to write this method in the same level of your onCreate()
and not inside. To do this, move onCreateOptionsMenu() below the very next closing brace.