I had the same issue and solved it by adding a TabHost on the Activity. You can set the MapActivity as the tab content and hide the button for it.
Example code:
map.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true" />
</LinearLayout>
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<Button
android:id="@+id/menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="menu" />
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</FrameLayout>
</TabHost>
</LinearLayout>
MyMapActivity.java:
public class MyMapActivity extends MapActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
}
MyActivity.java:
public class MyActivity extends TabActivity
{
private LayoutInflater inflater;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
inflater = LayoutInflater.from(context);
// Inflate menu here
// Get the TabHost
TabHost tabHost = getTabHost();
// Add the button and content
TabHost.TabSpec spec = tabHost.newTabSpec("myMapTab")
.setIndicator("Map")
.setContent(new Intent(this, MyMapActivity.class));
tabHost.addTab(spec);
// Hide the button
tabHost.getTabWidget().getChildAt(0).setVisibility(View.GONE);
MapView mapView = (MapView) tabHost.getTabContentView().getChildAt(0).findViewById(R.id.mapview)
}
}
I hope this solves your problem.