views:

375

answers:

5

I've got an app using MapActivity.onCreate() to initialize the map and show it on screen. Now I would like to add a menu to my app. From what I've found out I can't add a menu from MapActivity and need to use Activity (correct me if I'm wrong).

Now I have no idea how to "initialize" the map from my Activity-class.

And how would I have to fix the views, will I wrap my activity-layout around my Map-layout?

A: 

MapActivity extends Activity, so you should be able to add a menu.

Erich Douglass
+3  A: 

MapActivity extends a regular Android Activity, so there's nothing irregular you should need to do to create a menu.

Just override the onCreateOptionsMenu method, as shown in the developers' guide.

Christopher
A: 

MapActivity is a subclass of Activity, and thus you do it the same way as in any normal Activity (instructions here). I've been able to successfully create menus the same way in MapActivity as in a normal Activity.

Daniel Lew
A: 

I didn't try this - but i'd expect MapActivity to be a subclass of Activity. Did you try to override menu methods ?

Alex Volovoy
+1  A: 

sorry to bring this thread up again. But I am confonted with the same problem. When I have my mapactivity the onCreateOptionsMenu isn't called at all (I checked that with the logcat). Might this be in context that I start my MapActivity out of an ActivityGroup? Anyone can help?

Thanks

meio
having the same problem here. any news on that?
steff
(could no longer edit prev. comment): the thing is that onCreateOptionsMenu() gets called but just won't display any menu, regardless if i use a MenuInflater with an xml file or add items programmatically.
steff