title: horizontal listview in info window google map v2
body: <p>I creating a application base on <strong>google map api v2</strong></p>
  
  <p>I want to put a <code>horizontal list view</code> contain <code>image</code> , which get from sd card, into info window 
   there is my c<code>ustomwindow adapter class</code></p>
  
  <pre><code>class CustomInfoWindowAdapter implements InfoWindowAdapter {
  
      private final View mWindow;
      private final View mContents;
      LinearLayout myGallery;
  
      CustomInfoWindowAdapter() {
          mWindow = getLayoutInflater().inflate(R.layout.custom_info_window,
                  null);
          mContents = getLayoutInflater().inflate(
                  R.layout.custom_info_contents_with_listview, null);
      }
  
      @Override
      public View getInfoWindow(Marker marker) {
  
          render(marker, mWindow);
          return mWindow;
      }
  
      @Override
      public View getInfoContents(Marker marker) {
  
          render(marker, mContents);
          return mContents;
      }
  
      private void render(Marker marker, View view) {
          int badge = 0;
  
          myGallery = (LinearLayout) findViewById(R.id.mygallery);
  
          // get file from sd card
          String ExternalStorageDirectoryPath = Environment
                  .getExternalStorageDirectory().getAbsolutePath();
          String targetPath = ExternalStorageDirectoryPath + "/DCIM/Camera";
  
          File targetDirector = new File(targetPath);
  
          File[] files = targetDirector.listFiles();
  
          if (marker.equals(listMarkers.get(0))) {
              for (File file : files) {
                         myGallery.addView(insertPhoto(file.getAbsolutePath()));
              }
          }
  
          String title = marker.getTitle();
          TextView titleUi = ((TextView) view.findViewById(R.id.title));
          if (title != null) {
  
              SpannableString titleText = new SpannableString(title);
              titleText.setSpan(new ForegroundColorSpan(Color.RED), 0,
                      titleText.length(), 0);
              titleUi.setText(titleText);
          } else {
              titleUi.setText("");
          }
  
          String snippet = marker.getSnippet();
          TextView snippetUi = ((TextView) view.findViewById(R.id.snippet));
          if (snippet != null &amp;&amp; snippet.length() &gt; 12) {
              SpannableString snippetText = new SpannableString(snippet);
              snippetText.setSpan(new ForegroundColorSpan(Color.MAGENTA), 0,
                      10, 0);
              snippetText.setSpan(new ForegroundColorSpan(Color.BLUE), 12,
                      snippet.length(), 0);
              snippetUi.setText(snippetText);
          } else {
              snippetUi.setText("");
          }
      }
  }
  </code></pre>
  
  <p><strong>when i run the code , locat show Null pointer exeption at</strong> </p>
  
  <pre><code> for (File file : files) {
                              myGallery.addView(insertPhoto(file.getAbsolutePath()));
  </code></pre>
  
  <p><strong>xml code</strong> </p>
  
  <pre><code> &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent" 
  android:orientation="vertical"&gt;
  
  &lt;HorizontalScrollView
      android:layout_width="match_parent"
      android:layout_height="wrap_content" &gt;
      &lt;LinearLayout
          android:id="@+id/mygallery"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          /&gt;
  &lt;/HorizontalScrollView&gt;
  </code></pre>
  
  <p></p>
  
  <p>thank in advance for any help .</p>