[英]Opening an URL when clicking a Marker (Google Maps Android)
When you place a Marker on a Google Map Fragment you can touch (click) this to get a small "Pop-Up" with aditional information. 当您将标记放置在Google Map Fragment上时,您可以触摸(单击)该标记以获得带有附加信息的小“弹出窗口”。 Can I open a URL by clicking on this Pop-up once more? 我可以再次单击此弹出窗口来打开URL吗? If in a browser or whatever wouldn't matter. 如果在浏览器中或其他无关紧要的问题。
Is it possible and ìf, how? 有可能吗?
When you click marker, you will pass title and snippet in your popup window If you want to pass when you click popup, use onInfoWindow()
to open URL... 单击标记时,将在弹出窗口中传递标题和摘录。如果要在单击弹出窗口时传递,请使用onInfoWindow()
打开URL。
Googlemap gm;
gm.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
//Do your stuff here by passing url.
}
});
public void onInfoWindowClick(Marker arg0){
String url = "https://www.google.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.