title: Android inflate view using an existing view object
body: <p>I have a custom view that I would like to create from a resource template. My custom view constructor accepts additional parameters that are set as additional info for the custom view.</p>
  
  <p>Problem is when I inflate the view I get a view object that is not subclassed from from custom view since the inflate method is static and returns a generic new view instead of an instance of my custom view.</p>
  
  <p>Would I am looking for is a way to inflate the view by passing it my custom view object reference.</p>
  
  <pre>
  public class MLBalloonOverlayView extends View {
      MiscInfo mMiscInfo;
      public MLBalloonOverlayView(Context context, MiscInfo miscInfo) {
          super(context);
          mMiscInfo = miscInfo;
      }
      public View create(final int resource, final OverlayItem item, 
                          MapView mapView, final int markerID) {
          ViewGroup viewGroup = null;
          View balloon = View.inflate(getContext(), resource, viewGroup);
  
        // I want to return this object so later I can use its mMiscInfo
        //return this;
          return balloon;
      }
  }
  </pre>