Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

android - Dismiss a Dialog Fragment from a GoogleMap onInfoWindowClick callback

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...