So I have a Dialog fragment with a google map populated with a bunch of markers. I was the user to be able to scroll the map clicking on markers to reveal the marker InfoWindow that will give info about the markers location. Once the user has found the location they would like I want them to be able to Click the marker infowindow to select said location. When I call dismiss() from the onInfoWindowClick() callback function my app freezes. if I move the dismiss() call to onMarkerClick() there is no problem and my dialog will dismiss?
Dialog Fragment Header
class MapViewDialog(private val stationList: List<List<String>>) : DialogFragment(),
OnMapReadyCallback,
GoogleMap.OnMarkerClickListener,
GoogleMap.OnInfoWindowClickListener{
on click listeners
override fun onMarkerClick(p0: Marker?): Boolean {
//dismiss() *Placed Here it works fine But Not where I want it to Dismiss
return false
}
override fun onInfoWindowClick(p0: Marker?) {
dismiss() //Here it freezes the app
}
}
question from:
https://stackoverflow.com/questions/66057754/dismiss-a-dialog-fragment-from-a-googlemap-oninfowindowclick-callback 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…