I try to explain better: My app has a tab bar (a TabHost) and two of the tabs are two activities with a map each. When i click on the first tab I get the map and i can use it as i want. When I click on the second one i get the SAME map, with the SAME markers and the same path drawn on it and I can't even move the map. I don't want it to act like that. Every activity has to use a different maps.
I am using v2 maps and the two activities extend android.support.v4.app.FragmentActivity.
Note that if I click on the second activity first, I can use the map as I want and the problem repeats on the first activity.
I am not reusing nothing! Everything has different names, ids, ecc...
Please help!
P.S. here is the code that i use to initialize the map (in one activity):
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
Logger.log("mMap = null");
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFollow))
.getMap();
mMap.getUiSettings().setCompassEnabled(false);
mapContainer = getSupportFragmentManager().findFragmentById(R.id.mapFollow).getView();
// Check if we were successful in obtaining the map.
if (mMap == null) {
//TODO: dialog error map.
}
}
}
EVERY time I switch between the two activities I get the "mMap = null" log...