mMapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentByTag(MAP_FRAGMENT_TAG);
// We only create a fragment if it doe
Really hackish solution but, because given the poor fragment API...
Note that I'm doing this from a custom View and accessing the Activity using (Activity)getContext()
addOnLayoutChangeListener(new OnLayoutChangeListener(){
@Override
public void onLayoutChange(View v, int left, int top,
int right, int bottom, int oldLeft, int oldTop,
int oldRight, int oldBottom) {
GoogleMap map = mapFragment.getMap();
if (map != null) {
//Do stuff
}else{
removeOnLayoutChangeListener(this);
}
}
});