Skip to content

Instantly share code, notes, and snippets.

@sax1johno
Created August 12, 2015 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sax1johno/bf58e523da6e67b0621b to your computer and use it in GitHub Desktop.
Save sax1johno/bf58e523da6e67b0621b to your computer and use it in GitHub Desktop.
```java
public class MyMap extends MapFragment {
GoogleMap myMap;
boolean mapReady = false;
.....
@Override
protected void onCreateView(LayoutInflater inflater, ViewGroup vg, Bundle savedInstanceState) {
getMapAsync(new OnMapReadyCallback() {
@Override
protected void onMapReady(GoogleMap map) {
myMap = map;
mapReady = true;
// Do everything related to the map in here since you now have a map
// or you can check the mapReady method before you go to use the map
// to make sure it's there, then use the reference to myMap.
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment