Java SetOnInfo窗口单击标记的侦听器
我创建了一个名为Pin的标记,并试图在单击其窗口时打开一个活动/类。 从目前为止的情况来看,活动将打开,但当单击任何标记的窗口时 我想让它在点击标记针窗口时打开 我想开设的课程是holyStoneJava SetOnInfo窗口单击标记的侦听器,java,android,google-maps,google-maps-markers,Java,Android,Google Maps,Google Maps Markers,我创建了一个名为Pin的标记,并试图在单击其窗口时打开一个活动/类。 从目前为止的情况来看,活动将打开,但当单击任何标记的窗口时 我想让它在点击标记针窗口时打开 我想开设的课程是holyStone private void holystone() { // TODO Auto-generated method stub LatLng pos = new LatLng(52.972869, -9.427004); Marker Pin =
private void holystone()
{
// TODO Auto-generated method stub
LatLng pos = new LatLng(52.972869, -9.427004);
Marker Pin = theMap.addMarker(new MarkerOptions()
.title("Holy Stone of Clonrichert")
.snippet("Holy Stone of Clonrichert has been upgraded to a class two relic by the Vatican.")
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN))
.position(pos)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN))
);
// below displays the window...remove this!!!
//Pin.showInfoWindow();
Pin.isInfoWindowShown();
this.theMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker Pin) {
Intent intent = new Intent(MainActivity.this, holyStone.class);
startActivity(intent);
}
});
任何建议都会很好,谢谢你的关注 我使用if-else语句解决了这个问题 我在开始时添加了标记,就在onCreate方法之后 e、 g受保护的静态标记引脚=空; 受保护的静态标记=空
if(Casino.isInfoWindowShown()){
Intent intent = new Intent(MainActivity.this, TheRock.class);
startActivity(intent);
}
else if(Pin.isInfoWindowShown()){
Intent intent = new Intent(MainActivity.this, holyStone.class);
startActivity(intent);
}
}
如果你对我的答案有任何疑问,请提问。
谢谢。你的描述不清楚,听起来有点矛盾。请澄清“活动”窗口何时打开以及何时不打开。抱歉,我基本上希望在单击Marker Pin的信息窗口时打开holyStone.class。