1

I think I have the same issue with the post on this link Different markers show same infowindow content android google map v2

I am currently developing an app that integrates Google Maps v2 to allow users to take picture and automatically plotting a marker on the map.

I have a working InfoWindowAdapter but it seems that when I set a Bitmap as you can see below:

ImageView ivIcon = ((ImageView)myContentsView.findViewById(R.id.iconImg));
ivIcon.setImageBitmap(getResizedBitmap(myBitmap.getBp(),100,100));

When taking multiple pictures using my camera (which means it will have respective markers plotted on the map), the markers all share the same image, which is the latest image taken from the camera. I thought creating a Class by checking for difference in Bitmap object name would solve the problem but it did not.

It seems that when applying:

myMap.setInfoWindowAdapter(new MyInfoWindowAdapter());

it applies to all markers.

How do I go around doing it that each marker would have its own custom info window adapter?

Thanks!

======================================== EDIT =================================

I have an application that will allow users to take pictures which will also plot a marker on the map of the location of image capture. The marker will have a custom InfoWindow. I tried the solution but they are vague to me.

Do you mind explaining what did you do to your code such that doing:

googleMap.setInfoWindowAdapter(new InfoWindowAdapter()); will not affect all the markers on the map?

My current code for the CustomInfoBox is as follows:

class MyInfoWindowAdapter implements InfoWindowAdapter{

private final View myContentsView;

  MyInfoWindowAdapter(){
   myContentsView = getLayoutInflater().inflate(R.layout.custom_info_window, null);
  }

  @Override
  public View getInfoContents(Marker marker) {

   //TextView tvTitle = ((TextView)myContentsView.findViewById(R.id.title));
   //       tvTitle.setText(marker.getTitle());

            TextView tvSnippet = ((TextView)myContentsView.findViewById(R.id.snippet));
            tvSnippet.setText(marker.getSnippet());
   ImageView ivIcon = ((ImageView)myContentsView.findViewById(R.id.badge));
            ivIcon.setImageBitmap(getResizedBitmap(myBitmap.getBp(),100,100));
            System.out.println("Custom Info Window: " + myBitmap.getBp());
            return myContentsView;
  }

  @Override
  public View getInfoWindow(Marker marker) {

   // TODO Auto-generated method stub
   return null;

  }

 }

When I call googleMap.setInfoWindowAdapter(MyInfoWindowAdapter);, all markers have the same layout and thus same picture (last picture taken by user!) which is not something that I want.

Any help will be much appreciated! thanks

Community
  • 1
  • 1

0 Answers0