Use options menu without action bar

android, android-layout

Solution

I found the problem myself, stupid...

I changed:

public class MainActivity extends ActionBarActivity {

to

public class MainActivity extends Activity {

Problem

I'm am using this to hide the action-/titlebar in my android application ``` this.requestWindowFeature(Window.FEATURE_NO_TITLE); ``` I created my options menu with this: ``` MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.bottom_menu, menu); return(super.onCreateOptionsMenu(menu)); ``` And this is the bottom_menu.xml ``` <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/refresh" android:title="Neu laden" /> <item android:id="@+id/settings" android:title="Einstellungen" /> <item android:id="@+id/logout" android:title="Ausloggen" /> </menu> ``` When I press the menu button, the app crashes. When I don't hide the action-/titlebar, everything works fine. I already found this question on SO, but I don't solve the Problem: Hide Actionbar, Show Options Menu

Original source