2

I am using Google map to display the location of the buses and I have created custom Info window to replace the marker in Google map but I am getting it above the default one how can I disable the default one? Is it possiable to show all marker's info windows all the time without the need to touch them?

I appreciate any help.

enter image description here

strong text

    private boolean initMap() {
        if (map == null) {
            SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.map);
            map = mapFrag.getMap();
            // This part here to set the custom Info Window.
            if (map != null) {
                map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {

                    @Override
                    public View getInfoWindow(Marker arg0) {
                        return null;
                    }

                    @Override
                    public View getInfoContents(Marker marker) {
                        View v = getLayoutInflater().inflate(
                                R.layout.info_window, null);
                        TextView tv_route_direct = (TextView) v
                                .findViewById(R.id.route_direct);
                        tv_route_direct.setText(marker.getTitle());
                        return v;
                    }
                });
            }
        }
        return (map != null);
    }

    private void gotoLocation(int id, double lat, double lng,
            String route_direct) {
        final float zoom = 11;
        LatLng ll = null;

        if (markerMap.containsKey(id)) {
            // Update the location.

            // To figure out which ones was not updated.
            idList.add(id);

            marker = markerMap.get(id);
            // Remove from the map fragment.
            marker.remove();
            // Remove from the HashMap tp add the new one.
            markerMap.remove(id);

            ll = new LatLng(lat, lng);
            if (lat != 0 && lng != 0 && !route_direct.isEmpty()) {

                MarkerOptions markerOpt = new MarkerOptions()
                        .title(route_direct).position(ll).visible(true);
                marker = map.addMarker(markerOpt);
                markerMap.put(id, marker);

                CameraUpdate update = CameraUpdateFactory.newLatLngZoom(ll,
                        zoom);
                map.moveCamera(update);
                map.animateCamera(CameraUpdateFactory.zoomIn());
                map.animateCamera(CameraUpdateFactory.zoomTo(11), 2000, null);
                System.out.println("test end of the update part.");
            }
}
Mr Asker
  • 2,300
  • 11
  • 31
  • 56

1 Answers1

0

Try this:

marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.UrMarkerIcon));
Namrata
  • 1,683
  • 1
  • 17
  • 28