I just started working with Android and I have a problem with my map. I created a TabActivity and added MapActivity as one of the tabs with:
spec = tabHost.newTabSpec("map").setIndicator("Map");
intent= new Intent().setClass(this, NavisMapActivity.class);
spec.setContent(intent);
tabHost.addTab(spec);
In MapActivity I get MapView from xml layout with findViewById.
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="my_key_is_here"
android:clickable="false" />
When I load the app, everything works perfectly until I switch tabs or call another app. Basically when OnPause/OnStop is called. Then when I return to the map, its tiles start to flicker constantly. Only solution is to force the app to close.
This happens only with satellite tiles and from version 2.3.5 onward(tested it on an actual phone and in the Eclipse emulator).
So far I have tried:
- using mapView.destroyDrawingCache() command in onPause function
- adding mapView via code instead of xml layout
- destroying whole MapActivity with LocalActivityManager when tab is switched and creating a new one
None of this helped. Could anyone please help me? Thank you