Android:onInfoWindowClick从未调用过

时间:2013-09-24 01:09:57

标签: android google-maps google-maps-markers onclicklistener

我已经通过Android Google Maps v2实现了onInfoWindowClick。

public class myMap extends Activity implements GoogleMap.OnInfoWindowClickListener
{
    @Override
    public void onInfoWindowClick(Marker marker) {
        System.out.println("111");
        final String ssid = marker.getTitle();  

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        LayoutInflater inflater = this.getLayoutInflater();
        builder.setView(inflater.inflate(R.layout.dialog_signin, null))
        .setTitle("Network Connection")            
        .setMessage("Connect to"+ssid)
        .setCancelable(false)
        .setPositiveButton("Connect",new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog,int id) {
                wificonnector(ssid);
            }
        })
        .setNegativeButton("Cancel",new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog,int id) {
                dialog.cancel();
            }
        })
        .show();
    }
}

当我点击标记的infowindows(首先单击标记然后单击该标签)时,它完全没有响应。

1 个答案:

答案 0 :(得分:1)

确保在地图GoogleMap.setInfoWindowAdapter(this)

上设置此侦听器