title: Getting black ImageView using Picasso and Glide
body: <h2><strong>The problem</strong></h2>
  
  <p>I'm writing an Android app that's supposed to have a "Slideshow" feature on it. I've found <a href="https://github.com/daimajia/AndroidImageSlider" rel="nofollow noreferrer">this nice library</a>, based on Picasso, that does exactly what I wanted, and it worked just fine most of the times. </p>
  
  <p>Problem is, sometimes my images are not loaded into the slide <code>ImageView</code>... It only shows a "black canvas" as you can see on the screenshot below.</p>
  
  <p><a href="https://i.stack.imgur.com/Cp5M8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cp5M8.png" alt="enter image description here"></a></p>
  
  <p>I am loading the image from a local resource from my drawables. Sometimes it happens on Portrait mode, sometimes on Landscape mode. It doesn't matter which image I use, sometimes that "blackness" happens.</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <ul>
  <li><p>I'm using Android 5.0.2 and 4.4.2 - <em>It doesn't seem to happen on 4.4.2. Only on 5.0.2.</em></p></li>
  <li><p>It happened on a Moto X 2014 with android 5.1.</p></li>
  <li><p>The images I'm trying to load have 45KB on disk with a resolution of 900x445.</p></li>
  <li><p>I've turned on the layout rects as suggested, and these were the results:</p></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/og1Pk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/og1Pk.png" alt="Single slide"></a></p>
  
  <p>And it keep like that on scroll.</p>
  
  <p><a href="https://i.stack.imgur.com/ld7Uq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ld7Uq.png" alt="enter image description here"></a></p>
  
  <p>And sometimes, it gets white instead of black (Or white, then black).</p>
  
  <p><a href="https://i.stack.imgur.com/UVlnK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UVlnK.png" alt="enter image description here"></a></p>
  
  <p><strong>Something else I tried:</strong> My drawables were located on the <code>res/drawable</code> folder, when I've changed the files from that folder to the <code>res/drawable-xxxhdpi</code> the slider worked on the 5.0.2 device. <del>wtf???</del></p>
  
  <h2><strong>What have I tried so far</strong></h2>
  
  <p>I've tried different images, to load multiple images on the slide, and even <a href="https://github.com/daimajia/AndroidImageSlider/pull/170" rel="nofollow noreferrer">this pull request</a> that changes Picasso to Glide on the lib. Nothing seems to work and the error seems random.</p>
  
  <p><strong>Once I've tried to use URLs from the web instead of the actual drawables on the local storage, it worked. With the exact same images.</strong></p>
  
  <p>Here's how I'm loading the images:</p>
  
  <p><strong>Fragment.java</strong></p>
  
  <pre><code>private SliderLayout slider;
  private PagerIndicator indicator;
  
  // ...
  
  private void setupSlider() {
  
      HashMap&lt;String,Integer&gt; file_maps = new HashMap&lt;&gt;();
  
      file_maps.put("Blah",R.drawable.banner_1);
      file_maps.put("Bleh",R.drawable.banner_2);
      file_maps.put("Blih",R.drawable.banner_3);
      file_maps.put("Bloh",R.drawable.banner_4);
  
      for (String name : file_maps.keySet()) {
  
          DefaultSliderView dsv = new DefaultSliderView(getActivity());
  
          dsv.description(name)
                  .image(file_maps.get(name))
                  .error(R.drawable.banner_error)
                  .empty(R.drawable.empty)
                  .setScaleType(BaseSliderView.ScaleType.Fit)
                  .setOnSliderClickListener(this);
  
          //add your extra information
          dsv.bundle(new Bundle());
          dsv.getBundle()
                  .putString("extra",name);
  
          slider.addSlider(dsv);
      }
  
      slider.setPresetTransformer(SliderLayout.Transformer.Default);
      slider.setCustomIndicator(indicator);
      slider.setCustomAnimation(new DescriptionAnimation());
      slider.setDuration(4000);
      slider.addOnPageChangeListener(this);
  
  }
  </code></pre>
  
  <p><strong>fragment.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:custom="http://schemas.android.com/apk/res-auto"
      tools:context="com.example.fragments.Fragment"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
  
      &lt;ScrollView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/sv_main"&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:id="@+id/rl_main"&gt;
  
              &lt;com.daimajia.slider.library.SliderLayout
                  android:id="@+id/slider"
                  android:layout_width="match_parent"
                  android:layout_height="200dp"
                  /&gt;
              &lt;com.daimajia.slider.library.Indicators.PagerIndicator
                  android:id="@+id/custom_indicator"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignParentEnd="true"
                  android:layout_alignParentRight="true"
                  android:layout_below="@+id/slider"
                  custom:shape="oval"
                  custom:selected_color="#00BFA5"
                  custom:unselected_color="#55333333"
                  custom:selected_padding_left="@dimen/spacing_medium"
                  custom:selected_padding_right="@dimen/spacing_medium"
                  custom:selected_padding_top="3dp"
                  custom:selected_padding_bottom="@dimen/spacing_small"
                  custom:unselected_padding_left="@dimen/spacing_medium"
                  custom:unselected_padding_right="@dimen/spacing_medium"
                  custom:unselected_padding_top="@dimen/spacing_small"
                  custom:unselected_padding_bottom="4dp"
                  custom:selected_width="@dimen/spacing_medium"
                  custom:selected_height="@dimen/spacing_medium"
                  custom:unselected_width="6dp"
                  custom:unselected_height="6dp"
                  /&gt;
  
              &lt;LinearLayout
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_below="@+id/custom_indicator"
                  android:id="@+id/ll_main_body"&gt;
  
              &lt;/LinearLayout&gt;
  
          &lt;/RelativeLayout&gt;
  
      &lt;/ScrollView&gt;
  
      &lt;!-- Other stuff --&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I'm following <a href="https://github.com/daimajia/AndroidImageSlider/wiki/Start-Using" rel="nofollow noreferrer">the tutorial</a> from the libs <a href="https://github.com/daimajia/AndroidImageSlider/wiki" rel="nofollow noreferrer">wiki page</a>. And no errors are being thrown on the LogCat, which is making this a lot harder to solve.</p>
  
  <p>Any ideas?</p>