Google Play Service - Supportmapfragment.getmap() Always Returning Null
Possible Duplicate: How do I know the map is ready to get used when using the SupportMapFragment? I am currently testing the new Maps API V2 but I'm really having trouble gettin
Solution 1:
As CommonsWare stated in the linked question, the problem only occures when creating the SupportMapFragment
programmatically and not a <fragment>
XML tag.
If created programmatically, the map will be available in the onActivityCreated()
call. So my workaround is the following:
mMapFragment = newSupportMapFragment() {
@OverridepublicvoidonActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
GoogleMapmap= mMapFragment.getMap();
if (map != null) {
//Your initialization code goes here
}
}
};
Post a Comment for "Google Play Service - Supportmapfragment.getmap() Always Returning Null"