I have created a SupportMapFragment
dynamically, because I have some nested fragments and doing it with a <fragment>
was crashing my app (FragmentTabHost
doesn't play nice with <fragment>
when you change tabs).
Now I want to do a simpel getMap()
call but I always get null
. I have called it from onCreate
and from onCreateView
...so far I have researched, this is because the fragment is still not created, so probably doing it in onResume
is not a sure bet either, since the
getChildFragmentManager().beginTransaction().replace(R.id.map_frame, mMapFragment).commit();
is an Asynchronous call.
So my question is: How can I know that my Map is ready to be used? Is it there any listeners
that can be used for this? Any common way of doing it? I can't find much in the docs about this.