title: NullPointerException when inflating custom InfoWindowAdapter
body: <p>I am trying to extract a custom <code>InfoWindowAdapter</code> into a separate class file. I started with an inner class which works perfect:</p>
  
  <pre><code>public class FoobarMapActivity extends SherlockFragmentActivity {
  
      protected GoogleMap mMap;
      private final GoogleMap.InfoWindowAdapter mInfoWindowAdapter;
  
      public FoobarMapActivity() {
          mInfoWindowAdapter = new GoogleMap.InfoWindowAdapter() {
  
              @Override
              public View getInfoWindow(Marker marker) {
                  View window = getLayoutInflater().inflate(R.layout.custom_info_window, null);
                  render(marker, window);
                  return window;
              }
  
              @Override
              public View getInfoContents(Marker marker) {
                  return null;
              }
  
              private void render(Marker marker, View view) {
                  ((ImageView) view.findViewById(R.id.badge)).setImageResource(0);
                  TextView titleTextView = ((TextView) view.findViewById(R.id.title));
                  TextView snippetTextView = ((TextView) view.findViewById(R.id.snippet));
                  titleTextView.setText(StringHelper.setTextOrEmpty(marker.getTitle()));
                  snippetTextView.setText(StringHelper.setTextOrEmpty(marker.getSnippet()));
              }
  
          };
      }
  </code></pre>
  
  <p>But as soon as I put the <em>same</em> code into a separate class I run into a <code>NullPointerException</code> when I inflate the layout.</p>
  
  <pre><code>Caused by: java.lang.NullPointerException
    at android.view.LayoutInflater.from(LayoutInflater.java:210)
    at com.example.foobar.activities.CustomInfoWindowAdapter.&lt;init&gt;(CustomInfoWindowAdapter.java:20)
    at com.example.foobar.activities.FoobarMapActivity.&lt;init&gt;(FoobarMapActivity.java:107)
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1319)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1887)
  </code></pre>
  
  <p>Here is the custom class for the <code>InfoWindowAdapter</code>:</p>
  
  <pre><code>package com.example.foobar.activities;
  
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.model.Marker;
  
  import com.example.foobar.R;
  import com.example.foobar.utils.StringHelper;
  
  public class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
  
      protected View mWindow;
  
      public CustomInfoWindowAdapter(Context context) {
          LayoutInflater inflater = LayoutInflater.from(context);
          mWindow = inflater.inflate(R.layout.custom_info_window, null);
      }
  
      @Override
      public View getInfoWindow(Marker marker) {
          render(marker, mWindow);
          return mWindow;
  
  
      @Override
      public View getInfoContents(Marker marker) {
          return null;
      }
  
      private void render(Marker marker, View view) {
          ((ImageView) view.findViewById(R.id.badge)).setImageResource(0);
          TextView titleTextView = ((TextView) view.findViewById(R.id.title));
          TextView snippetTextView = ((TextView) view.findViewById(R.id.snippet));
          titleTextView.setText(StringHelper.setTextOrEmpty(marker.getTitle()));
          snippetTextView.setText(StringHelper.setTextOrEmpty(marker.getSnippet()));
      }
  
  }
  </code></pre>
  
  <p>Here I instatiate the custom adapter:</p>
  
  <pre><code>public class FoobarMapActivity extends SherlockFragmentActivity {
  
      private final GoogleMap.InfoWindowAdapter mInfoWindowAdapter;
  
      public FoobarMapActivity() {
          mInfoWindowAdapter = new CustomInfoWindowAdapter(getBaseContext()); // line 107
      }
  </code></pre>