Skip to content

Instantly share code, notes, and snippets.

@wviana
Last active May 17, 2016 16:38
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 wviana/19fb4aad618ad423bb45b0fcbd521acb to your computer and use it in GitHub Desktop.
Save wviana/19fb4aad618ad423bb45b0fcbd521acb to your computer and use it in GitHub Desktop.
private boolean initMap() {
if (mMap == null) {
//mMap = new GigMobileMap(mMapView.getExtendedMap());
mMapView.getExtendedMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
GigMobileMap tmpMap = new GigMobileMap(googleMap);
MapsInitializer.initialize(getActivity());
tmpMap.initMap(getActivity(), mapListener);
mMap = tmpMap;
notifyAll();
}
});
}
while(mMap == null){
try {
Log.d(this.getClass().getSimpleName(), "Esperando Map");
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return (mMap != null);
}
private boolean initMap() {
final Object lock = new Object();
if (mMap == null) {
//mMap = new GigMobileMap(mMapView.getExtendedMap());
mMapView.getExtendedMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
synchronized (lock) {
GigMobileMap tmpMap = new GigMobileMap(googleMap);
MapsInitializer.initialize(getActivity());
tmpMap.initMap(getActivity(), mapListener);
mMap = tmpMap;
lock.notifyAll();
}
}
});
}
while(mMap == null){
try {
Log.d(this.getClass().getSimpleName(), "Esperando Map");
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return (mMap != null);
}
private boolean initMap() {
final Object lock = new Object();
if (mMap == null) {
//mMap = new GigMobileMap(mMapView.getExtendedMap());
mMapView.getExtendedMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
GigMobileMap tmpMap = new GigMobileMap(googleMap);
MapsInitializer.initialize(getActivity());
tmpMap.initMap(getActivity(), mapListener);
mMap = tmpMap;
lock.notifyAll();
}
});
}
while(mMap == null){
try {
Log.d(this.getClass().getSimpleName(), "Esperando Map");
lock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return (mMap != null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment