How to use multiple MapActivities/MapViews per Android application/process

According to the Android JavaDocs, it
is only possible to have one
MapActivity per class

It’s not one map view per class, it’s per process.

It’s known that you might experience some issues when using multiple mapviews in one process. Usually this is the case (your app running in one process) if you don’t configure anything specific.
You could though use the android:process attribute in your manifest to assign to your acitivites:

<activity android:name=".activity.directory.MapView1" android:process=":MapView1">

<activity android:name=".activity.directory.MapView2" android:process=":MapView2">

This way you have the activities running in separate processes, which works well if you don’t use any shared static variables across activities.

Also see the discussion on the bug in the android bug tracker:

http://code.google.com/p/android/issues/detail?id=3756

Leave a Comment