title: Animated infowindow in Google Maps v2
body: <p>I recently asked about applying an animation to a marker popup window (infowindow) and was explained why that wasn't possible:</p>
  
  <blockquote>
    <p><strong>Note:</strong> The info window that is drawn is not a live view. The view is rendered as an image (using <code>View.draw(Canvas)</code>) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (e.g., after an image has loaded), call <code>showInfoWindow()</code>. Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.</p>
  </blockquote>
  
  <p>Researching some more, I found a project using V1 that manually creates the View on the marker's position. To do this, the other guy did something like this:</p>
  
  <pre><code>public void showPopup(View view, GeoPoint point, boolean centerPopup) {
  
      removeAllViews();
  
      MapView.LayoutParams lp = new MapView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
              point,
              Utils.dipsToPixels(0.0f, mContext),
              Utils.dipsToPixels(-12.0f, mContext),
              MapView.LayoutParams.BOTTOM_CENTER);
  
      if (centerPopup) {
          getController().animateTo(point);
          mIgnoreNextChangeEvent = true;
      }
  
      View balloon = mInflater.inflate(R.layout.balloon, null);
      balloon.setLayoutParams(lp);
  
      ((ViewGroup) balloon.findViewById(R.id.balloonBody)).addView(view);
  
      balloon.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.bounce_in));
      addView(balloon);
  }
  </code></pre>
  
  <p>So he manually creates a balloon view and attaches it to the MapView.</p>
  
  <p>I've been trying to emulate this same thing using V2 but I haven't been able and I don't even know if this is possible at all. For example, I use "GoogleMap" instead of "MapView" and I'm not sure if this has anything to do with some of the differences between V1 and V2.</p>
  
  <p>I'm going to add what I have so far just as a reference. I tried to replicate the code from the other project and try to modify it so it will work in this one but I haven't been able to even compile it.</p>
  
  <pre><code>public boolean onMarkerClick(Marker marker) {
      map.removeAllViews();
  
      MapView.LayoutParams lp = new MapView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
              marker.getPosition(),
              Tools.dipsToPixels(0.0f, this),
              Tools.dipsToPixels(-12.0f, this),
              MapView.LayoutParams.BOTTOM_CENTER);
  
      if (centerPopup) {
          getController().animateTo(point);
          mIgnoreNextChangeEvent = true;
      }
  
      View balloon = mInflater.inflate(R.layout.balloon, null);
      balloon.setLayoutParams(lp);
  
      ((ViewGroup) balloon.findViewById(R.id.balloonBody)).addView(view);
  
      balloon.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.bounce_in));
      addView(balloon);
  
      return false;
  }
  </code></pre>