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
As I mentioned in the comments this seems to be a problem with the Google Maps API:
http://code.google.com/p/android/issues/detail?id=19154&q=google%20maps%20tiles&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
Let’s hope that they fix it some time soon.
I want to try some of these alternatives:
Alternatives to google maps api
Will report back if any is worth dealing with 🙂
This one also seems promising: http://code.google.com/p/mapsforge/