title: Display image in infowindow from URL Google Maps Android API
body: <p>I have a map in a fragment in a navigation drawer. Now the code for the map is found in the MainActivity.java of the navigation drawer. I have a for loop inside onMapReady which pin markers on my map. Now each iteration of the for loop takes retrieved data from Firebase, to be able to pin the markers. The retrieved data also contains URLs for images and I need to use those URLs to display an image in the infowindow of each marker. I've tried to understand the other solutions provided but I haven't got any idea how to implement this. </p>
  
  <p>this is my code so far my code:</p>
  
  <pre><code>@Override
  public void onMapReady(GoogleMap googleMap) {
      mMap = googleMap;
      ...
  
      for (infoToStore details : info) {
          marker = mMap.addMarker(new MarkerOptions()
                  .position(new LatLng(Double.parseDouble(details.getLat()), Double.parseDouble(details.getLng())))
          .title(details.getName())
          .snippet(details.getDesc()));
  
      }
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've tried to implement it as follows but the infowindow is blank; not showing the TextViews nor the ImageView.</p>
  
  <pre><code>@Override
  public void onMapReady(GoogleMap googleMap) {
      mMap = googleMap;
  
      for (final infoToStore details : info) {
          marker = mMap.addMarker(new MarkerOptions()
                  .position(new LatLng(Double.parseDouble(details.getLat()), Double.parseDouble(details.getLng())))
          .title(details.getName())
          .snippet(details.getDesc()));
  
          mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
  
              @Override
              public View getInfoWindow(Marker marker) {
                  return null;
              }
  
              @Override
              public View getInfoContents(Marker marker) {
                  View v = getLayoutInflater().inflate(R.layout.popup, null);
  
                  TextView name = (TextView) v.findViewById(R.id.name);
                  TextView desc = (TextView) v.findViewById(R.id.desc);
                  ImageView image = (ImageView) v.findViewById(R.id.image);
  
  
  
                  name.setText(marker.getTitle());
                  desc.setText(marker.getSnippet());
  
                  Picasso.with(getApplicationContext())
                          .load(URLString)
                          .into(image);
  
  
                  return v;
              }
          });
  
      }
  }
  </code></pre>
  
  <p>here's the popup.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="horizontal"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;ImageView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/image"/&gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/name"/&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/desc"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/q2b1J.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q2b1J.jpg" alt="enter image description here"></a></p>