android - The menu does not appear in the map activity -


i trying create menu option none, normal, terrain, satellite, hybrid (google map) in map activity enable users select desired map type menu in not being shown in map activity.

i have tried add super.oncreateoptionsmenu(menu); oncreateoptionsmenu before inflater without success.

how can fix it?

map activity:

public class map extends fragmentactivity implements onmapreadycallback, connectioncallbacks, onconnectionfailedlistener{

@override public boolean oncreateoptionsmenu(menu menu) {     menuinflater inflater = getmenuinflater();     inflater.inflate(r.menu.map_menu, menu);     system.out.println("abc map oncreateoptionsmenu invoked.");      return true; }  @override     public boolean onoptionsitemselected(menuitem item) {         switch (item.getitemid()) {         case r.id.maptypenone:             map.setmaptype(googlemap.map_type_none);                             break;          case r.id.maptypenormal:             map.setmaptype(googlemap.map_type_normal);                           break;          case r.id.maptypesatellite:             map.setmaptype(googlemap.map_type_satellite);                            break;          case r.id.maptypeterrain:             map.setmaptype(googlemap.map_type_terrain);                          break;         case r.id.maptypehybrid:             map.setmaptype(googlemap.map_type_hybrid);                           break;          default:             break;         }         return super.onoptionsitemselected(item);     } 

}

map_menu.xml

<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" >      <item         android:id="@+id/maptypenormal"         android:title="normal"/>     <item         android:id="@+id/maptypesatellite"         android:title="satellitte"/>     <item         android:id="@+id/maptypeterrain"         android:title="terrain"/>     <item         android:id="@+id/maptypehybrid"         android:title="hybrid"/>     <item         android:id="@+id/maptypenone"         android:title="none"/> </menu> 

check mapactivity.java extending.

if extends fragmentactivity change extends appcompatactivity.

and in styles make sure ..

<style name="apptheme" parent="theme.appcompat.light.darkactionbar">         ... </style> 

add in build.gradle (module:app) inside dependencies

dependencies {     ..     compile 'com.android.support:appcompat-v7:22.2.0'  } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -