Tengo un error que me salta al querer mostrar el infowindow
personalizado de google maps, el método showInfoWindow
es el que hace saltar el error.
Dentro de la clase InfoWindowMarer
al hacer debug note que esta llamando demasiadas veces a los métodos sobrescritos getInfoContents
y getInfoWindow
de la clase InfoWindowAdapter
, en otra vista estoy utilizando la misma para mostrar y sale correctamente, cuando hago la llamda a un servicio rest, en la implementacion de la respuesta implemento el siguiente codigo:
runOnUiThread(new Runnable() {
@Override
public void run() {
map.setInfoWindowAdapter(new InfoWindowMarker(getApplicationContext(), markerDesde, viaje.getPasajero()));
animateCameraToPoint(viaje.getPuntoDesde());
markerDesde.showInfoWindow();
}
});
En el método onMapReady con la variable markerDesde
se hace lo siguiente:
MarkerOptions markerOptionsDesde = new MarkerOptions().position(viaje.getPuntoDesde()).title(getString(R.string.desde));
//markerOptionsDesde.draggable(true);
markerOptionsDesde.flat(true)
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_radio_button_unchecked_black_24dp))
.anchor(0.5f, 0.5f);
markerDesde = map.addMarker(markerOptionsDesde);
markerHasta = map.addMarker(markerOptionsHasta);
CameraPosition cameraPosition = new CameraPosition.Builder().target(midPoint(markerDesde.getPosition().latitude, markerDesde.getPosition().longitude, markerHasta.getPosition().latitude, markerHasta.getPosition().longitude))
.zoom(14) // Sets the zoom
.bearing(angleBteweenCoordinate(markerDesde.getPosition().latitude, markerDesde.getPosition().longitude, markerHasta.getPosition().latitude, markerHasta.getPosition().longitude)) // Sets the orientation of the camera to
.tilt(30) // Sets the tilt of the camera to 30 degrees
.build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
Luego en este método también se realiza una consulta a la api directions para trazar una polilinea entre 2 puntos.
onMapReady se llama cuando se inicia el Activity, el problema se da cuando presiono un botón que consulta a un servicio rest, en la respuesta intento mostrar el marcador y ahi explota.
Stacktrace:
11-03 22:05:56.991 14532-14532/com.system.sumo.retaxi E/UncaughtException: java.lang.StackOverflowError: stack size 8MB
at android.os.Parcel.obtain(Parcel.java:314)
at vw.a(:com.google.android.gms.DynamiteModulesB:88)
at maps.ad.G.a(Unknown Source)
at maps.ad.G.a(Unknown Source)
at maps.D.c.a(Unknown Source)
at maps.D.d.c(Unknown Source)
at maps.ad.S.g(Unknown Source)
at abw.onTransact(:com.google.android.gms.DynamiteModulesB:145)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.maps.model.internal.zzf$zza$zza.showInfoWindow(Unknown Source)
at com.google.android.gms.maps.model.Marker.showInfoWindow(Unknown Source)
at com.system.sumo.retaxi.utils.maps.ImageRefresherMarker.onSuccess(ImageRefresherMarker.java:17)
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:657)
at com.system.sumo.retaxi.utils.maps.InfoWindowMarker.getInfoContents(InfoWindowMarker.java:42)
at com.google.android.gms.maps.GoogleMap$7.zzi(Unknown Source)
at com.google.android.gms.maps.internal.zzd$zza.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:380)
at vw.b(:com.google.android.gms.DynamiteModulesB:112)
at maps.ad.G.a(Unknown Source)
at maps.ad.G.a(Unknown Source)
at maps.D.c.a(Unknown Source)
at maps.D.d.c(Unknown Source)
at maps.ad.S.g(Unknown Source)
at abw.onTransact(:com.google.android.gms.DynamiteModulesB:145)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.maps.model.internal.zzf$zza$zza.showInfoWindow(Unknown Source)
at com.google.android.gms.maps.model.Marker.showInfoWindow(Unknown Source)
at com.system.sumo.retaxi.utils.maps.ImageRefresherMarker.onSuccess(ImageRefresherMarker.java:17)
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:657)
at com.system.sumo.retaxi.utils.maps.InfoWindowMarker.getInfoContents(InfoWindowMarker.java:42)
at com.google.android.gms.maps.GoogleMap$7.zzi(Unknown Source)
at com.google.android.gms.maps.internal.zzd$zza.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:380)
at vw.b(:com.google.android.gms.DynamiteModulesB:112)
at maps.ad.G.a(Unknown Source)
at maps.ad.G.a(Unknown Source)
at maps.D.c.a(Unknown Source)
at maps.D.d.c(Unknown Source)
at maps.ad.S.g(Unknown Source)
at abw.onTransact(:com.google.android.gms.DynamiteModulesB:145)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.maps.model.internal.zzf$zza$zza.showInfoWindow(Unknown Source)
at com.google.android.gms.maps.model.Marker.showInfoWindow(Unknown Source)
at com.system.sumo.retaxi.utils.maps.ImageRefresherMarker.onSuccess(ImageRefresherMarker.java:17)
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:657)
at com.system.sumo.retaxi.utils.maps.InfoWindowMarker.getInfoContents(InfoWindowMarker.java:42)
at com.google.android.gms.maps.GoogleMap$7.zzi(Unknown Source)
at com.google.android.gms.maps.internal.zzd$zza.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:380)
at vw.b(:com.google.android.gms.DynamiteModulesB:112)
at maps.ad.G.a(Unknown Source)
at maps.ad.G.a(Unknown Source)
at maps.D.c.a(Unknown Source)
at maps.D.d.c(Unknown Source)
at maps.ad.S.g(Unknown Source)
at abw.onTransact(:com.google.android.gms.DynamiteModulesB:145)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.maps.model.internal.zzf$zza$zza.showInfoWindow(Unknown Source)
at com.google.android.gms.maps.model.Marker.showInfoWindow(Unknown Source)
at com.system.sumo.retaxi.utils.maps.ImageRefresherMarker.onSuccess(ImageRefresherMarker.java:17)
at com.squareup.picasso.RequestCreator.into(RequestCreator.java:657)
at com.system.sumo.retaxi.utils.maps.InfoWindowMarker.getInfoContents(InfoWindowMarker.java:42)
at com.google.android.gms.maps.GoogleMap$7.zzi(Unknown Source)
at com.google.android.gms.maps.internal.zzd$zza.onTransact(Unknown Source)
at android.os.Binder.transact(Binder.java:380)
at vw.b(:com.google.android.gms.DynamiteModulesB:112)
at maps.ad.G.a(Unknown Source)
at maps.ad.G.a(Unknown Source)
at maps.D.c.a(Unknown Source)
at maps.D.d.c(Unknown Source)