I am trying to implement a Google Map marker with infoWindow that if someone clicks on this infoWindow, it plays a song and if clicks again, it stops. To visualize this, I write a custom infoWindow layout. There is, in infoWindow, you can see user and track info with a button. This button shows play icon if the track does not begin to play yet, and if it pressed (press on infoWindow, not the button), I hope it changes its icon from "play" to "stop". However, I cannot change my custom infoWindow's view depending on infoWindowClickListener activity. I tried to change infoWindowAdapter especially but I do not want to change view of all other infoWindows and also I want to see the change immediately. In this way, the infoWindow refreshes its view after I click on the marker again. In other words, it does not change the view simultaneously with my click action.
Here you can see what I am talking about. Stop status on left, play status on right:

Here is my futile effort for adapter:
public class OrangeInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
    Context context;
    ImageButton playButton;
    boolean onPlay;
    public OrangeInfoWindowAdapter(Context context, boolean onPlay) {
        this.context = context;
        this.onPlay = onPlay;
    }
    @Override
    public View getInfoWindow(Marker arg0) {
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.orange_infowindow, null);
        v.setMinimumWidth(280);
        v.setMinimumHeight(120);
        TextView tvUsername = (TextView) v.findViewById(R.id.tv_username);
        TextView tvTrack = (TextView) v.findViewById(R.id.tv_track);
        int index = arg0.getTitle().indexOf("*");
        try {
            tvUsername.setText(arg0.getTitle().substring(0, index - 1) + "\n" + arg0.getTitle().substring(index + 2));
        } catch (StringIndexOutOfBoundsException e) {
        }
        tvUsername.setTextSize(10);
        tvUsername.setTextColor(Color.rgb(70, 70, 70));
        index = arg0.getSnippet().indexOf("*");
        try {
            tvTrack.setText(arg0.getSnippet().substring(0, index - 1) + "\n" + arg0.getSnippet().substring(index + 2));
        } catch (StringIndexOutOfBoundsException e) {
        }
        tvTrack.setTextSize(10);
        tvTrack.setTextColor(Color.rgb(230, 92, 1));
        playButton = (ImageButton) v.findViewById(R.id.playButton);
        if (onPlay)
            onPlay();
        return v;
    }
    public void onPlay() {
        playButton.setBackgroundResource(R.drawable.info_stop_button);
    }
    public void onStop() {
        playButton.setBackgroundResource(R.drawable.info_play_button);
    }
    @Override
    public View getInfoContents(Marker arg0) {
        return null;
    }
}
And this is my onInfoWindowClick():
@Override
public void onInfoWindowClick(Marker marker) {
    if (!infoWindowPlayerActive) {
        int index = findMarkerIndex(marker);
        OrangeInfoWindowAdapter infoWindowAdapter2 = new OrangeInfoWindowAdapter(getActivity().getApplicationContext(), true);
        googleMap.setInfoWindowAdapter(infoWindowAdapter2);
        new InfoWindowPlayerTask(mainActivity).execute(activities.get(index).getTrackId());
        infoWindowPlayerActive = true;
    }
    else {
        // same thing...
        infoWindowPlayerActive = false;
    }
}
If you want more information to understand the problem clearly, please ask me.
 
     
    