I create a tabbed view with a list and a map, this is the code used to build the tab:
tabHost = getTabHost();
TabSpec tabS开发者_JAVA百科pec = tabHost.newTabSpec("tab_map");
Intent i = new Intent().setClass(this, MyMapActivity.class);
tabSpec.setIndicator("Map",
getResources().getDrawable(android.R.drawable.ic_menu_mapmode))
.setContent(i);
tabHost.addTab(tabSpec);
now I need to access the MapView to set some Overlay on that map but if I try to do this:
MapView mapView = (MapView) findViewById(R.id.myMap);
the reference is always null, which is the right way? Thanks!!!
-- Luca
you could use
intent.putExtra(MyMapActivity.Something, value);
depends upon where you call MapView as whether the view has been inflated yet or not..obviously if it has not been inflated yet you might get a null
精彩评论