<p dir="auto"><strong>Glide Version</strong>: 3.8.0</p>

<p dir="auto"><strong>Integration libraries</strong>: none</p>

<p dir="auto"><strong>Device/Android Version</strong>: any</p>

<p dir="auto"><strong>Issue details / Repro steps / Use case background</strong>:</p>
<p dir="auto">I try to load a gradient, which is defined as <code class="notranslate">my_gradient.xml</code>:</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
    &lt;gradient
        android:type=&quot;linear&quot;
        android:angle=&quot;0&quot;
        android:startColor=&quot;#f6ee19&quot;
        android:endColor=&quot;#115ede&quot; /&gt;
&lt;/shape&gt;"><pre class="notranslate">&lt;?<span class="pl-ent">xml</span><span class="pl-e"> version</span>=<span class="pl-s"><span class="pl-pds">"</span>1.0<span class="pl-pds">"</span></span><span class="pl-e"> encoding</span>=<span class="pl-s"><span class="pl-pds">"</span>utf-8<span class="pl-pds">"</span></span>?&gt;
&lt;<span class="pl-ent">shape</span> <span class="pl-e">xmlns</span><span class="pl-e">:</span><span class="pl-e">android</span>=<span class="pl-s"><span class="pl-pds">"</span>http://schemas.android.com/apk/res/android<span class="pl-pds">"</span></span>&gt;
    &lt;<span class="pl-ent">gradient</span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">type</span>=<span class="pl-s"><span class="pl-pds">"</span>linear<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">angle</span>=<span class="pl-s"><span class="pl-pds">"</span>0<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">startColor</span>=<span class="pl-s"><span class="pl-pds">"</span>#f6ee19<span class="pl-pds">"</span></span>
        <span class="pl-e">android</span><span class="pl-e">:</span><span class="pl-e">endColor</span>=<span class="pl-s"><span class="pl-pds">"</span>#115ede<span class="pl-pds">"</span></span> /&gt;
&lt;/<span class="pl-ent">shape</span>&gt;</pre></div>
<p dir="auto">Loading code:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Glide.with(context).load(R.id.my_gradient).crossFade().into(imageView);"><pre class="notranslate"><span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-s1">context</span>).<span class="pl-en">load</span>(<span class="pl-smi">R</span>.<span class="pl-s1">id</span>.<span class="pl-s1">my_gradient</span>).<span class="pl-en">crossFade</span>().<span class="pl-en">into</span>(<span class="pl-s1">imageView</span>);</pre></div>
<p dir="auto">But the ImageView is still empty.</p>
<p dir="auto">If I  create GradientDrawable programmatically I get the following exception:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="GradientDrawable gd = new GradientDrawable(
            GradientDrawable.Orientation.TOP_BOTTOM, new int[] {0xFF616261, 0xFF131313});
gd.setCornerRadius(0f);
Glide.with(context).load(gd).crossFade().into(imageView);"><pre class="notranslate"><span class="pl-smi">GradientDrawable</span> <span class="pl-s1">gd</span> = <span class="pl-k">new</span> <span class="pl-smi">GradientDrawable</span>(
            <span class="pl-smi">GradientDrawable</span>.<span class="pl-s1">Orientation</span>.<span class="pl-c1">TOP_BOTTOM</span>, <span class="pl-k">new</span> <span class="pl-smi">int</span>[] {<span class="pl-c1">0xFF616261</span>, <span class="pl-c1">0xFF131313</span>});
<span class="pl-s1">gd</span>.<span class="pl-en">setCornerRadius</span>(<span class="pl-c1">0f</span>);
<span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-s1">context</span>).<span class="pl-en">load</span>(<span class="pl-s1">gd</span>).<span class="pl-en">crossFade</span>().<span class="pl-en">into</span>(<span class="pl-s1">imageView</span>);</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="java.lang.IllegalArgumentException: Unknown type class android.graphics.drawable.GradientDrawable. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class
                                                                           at com.bumptech.glide.RequestManager.loadGeneric(RequestManager.java:629)
                                                                           at com.bumptech.glide.RequestManager.load(RequestManager.java:598)"><pre class="notranslate"><code class="notranslate">java.lang.IllegalArgumentException: Unknown type class android.graphics.drawable.GradientDrawable. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class
                                                                           at com.bumptech.glide.RequestManager.loadGeneric(RequestManager.java:629)
                                                                           at com.bumptech.glide.RequestManager.load(RequestManager.java:598)
</code></pre></div>
<p dir="auto">Do I something wrong or there is no way to load gradients with Glide?</p>
<h2 dir="auto">Idea</h2>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Glide.with(this).load(bitmap).into(imageView);
Glide.with(this).load(drawable).into(imageView);"><pre class="notranslate"><span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-smi">this</span>).<span class="pl-en">load</span>(<span class="pl-s1">bitmap</span>).<span class="pl-en">into</span>(<span class="pl-s1">imageView</span>);
<span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-smi">this</span>).<span class="pl-en">load</span>(<span class="pl-s1">drawable</span>).<span class="pl-en">into</span>(<span class="pl-s1">imageView</span>);</pre></div>
<p dir="auto">This looks weird compared to <code class="notranslate">ImageView.setImageBitmap(bitmap)</code>, but if you need animation and error handling (null bitmap), the above could become an easy to use, fire and forget, go-to line instead of duplicating code.<br>
Note: you've already made a wrapper of <code class="notranslate">ImageView#setImageResource</code> and <code class="notranslate">ImageView#setImageUri</code>.</p>
<p dir="auto">Currently they throw</p>
<blockquote>
<p dir="auto">Caused by: java.lang.IllegalArgumentException: Unknown type android.graphics.Bitmap@44759ab8. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class.<br>
<code class="notranslate">at com.bumptech.glide.RequestManager.loadGeneric(RequestManager.java:382)</code><br>
<code class="notranslate">at com.bumptech.glide.RequestManager.load(RequestManager.java:374)</code></p>
</blockquote>
<h2 dir="auto">Context</h2>
<p dir="auto">This came up when I was trying to display a captured image using Glide (oversimplified code):</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), Activity.RESULT_FIRST_USER);

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(requestCode == REQUEST_CODE_GET_PICTURE &amp;&amp; resultCode == Activity.RESULT_OK) {
        Bitmap bitmap = (Bitmap)data.getExtras().get(&quot;data&quot;);
        Glide.with(this).load(bitmap)/*...*/.into(image);"><pre class="notranslate"><span class="pl-en">startActivityForResult</span>(<span class="pl-k">new</span> <span class="pl-smi">Intent</span>(<span class="pl-smi">MediaStore</span>.<span class="pl-c1">ACTION_IMAGE_CAPTURE</span>), <span class="pl-smi">Activity</span>.<span class="pl-c1">RESULT_FIRST_USER</span>);

<span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">onActivityResult</span>(<span class="pl-smi">int</span> <span class="pl-s1">requestCode</span>, <span class="pl-smi">int</span> <span class="pl-s1">resultCode</span>, <span class="pl-smi">Intent</span> <span class="pl-s1">data</span>) {
    <span class="pl-k">if</span>(<span class="pl-s1">requestCode</span> == <span class="pl-c1">REQUEST_CODE_GET_PICTURE</span> &amp;&amp; <span class="pl-s1">resultCode</span> == <span class="pl-smi">Activity</span>.<span class="pl-c1">RESULT_OK</span>) {
        <span class="pl-smi">Bitmap</span> <span class="pl-s1">bitmap</span> = (<span class="pl-smi">Bitmap</span>)<span class="pl-s1">data</span>.<span class="pl-en">getExtras</span>().<span class="pl-en">get</span>(<span class="pl-s">"data"</span>);
        <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-smi">this</span>).<span class="pl-en">load</span>(<span class="pl-s1">bitmap</span>)<span class="pl-c">/*...*/</span>.<span class="pl-en">into</span>(<span class="pl-s1">image</span>);</pre></div>