Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Google map implementation relies heavily on several life-cycle methods (onCreate, onCreateView, onDestroy, onResume and onPause). You should relay those calls to the MapFragment if you encapsulate it within you own fragment. The map should already be initialized after you call mapView.getMap() and get a GoogleMap in return.</p> <p>If you get null from getMap() several things might have happened:</p> <ul> <li>You didn't call onCreate and/or onCreateView on the MapFragment (call getMap() after those methods)</li> <li>You are lacking the OpenGL ES 2 feature entry in your manifest</li> <li>You are lacking the required permissions for maps</li> <li>Google Play SDK Services are not installed on the device or they are too old</li> </ul> <p>I read about the initialize(this) solution quite often here on StackOverflow but it is actually not needed in most of the cases.</p> <p><strong>EDIT:</strong> I just saw that you are adding the Mapfragment through a transaction. Have you considered using just a MapView instead within your PoiFragment? I believe that by using the MapFragment and adding it through a transaction you get a timing issue. The transaction is propably not finished while you are still in your PoiFragment.onCreateView method (hence Maps is not initialized, yet). You could try using onResume but you would have to make sure, that you init your map code only once as onResume will be called more often.</p> <p>My suggestions in terms of architecture:</p> <ul> <li>Use MapFragment directly within your activity if that is feasible</li> <li>Extend the Mapfragment if you have enough code to put in there</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload