2

Okay, this thing is really driving me crazy. I tried everything, but I cant make this thing to work.

This is my xml file:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/settings_id"
        android:title="@string/settings"
        android:showAsAction="always"
        />
    <item
        android:id="@+id/about_us_id"
        android:title="@string/about_us"
        android:showAsAction="never"
        />
    <item
        android:id="@+id/rate_id"
        android:title="@string/rate_us"
        android:showAsAction="never"
        />
</menu>

These are my onCreateOptionsMenu() and onCreate() methods:

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


@Override   
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

}

Menu IS working, elements are shown, but I cant put them under overflow menu (those three dots). I have to use fragmentactivity, since I use google maps and this is also why I can't use setHasOptionsMenu(true)

kor
  • 41
  • 7

1 Answers1

1

It is:

How to force use of overflow menu on devices with menu button

Put the function in onCreate() and it works.

Community
  • 1
  • 1
kor
  • 41
  • 7