title: NinePatchDrawable > java.lang.ClassCastException
body: <p>I am getting an error when trying to load an asset from the resource folder:</p>
  
  <pre><code>NinePatchDrawable ninePatchObj = ((NinePatchDrawable) context.getResources().getDrawable(R.drawable.orange_btn));
  </code></pre>
  
  <p>Returns</p>
  
  <pre><code>java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable
  </code></pre>
  
  <p>This asset works properly when using the XML button object.</p>
  
  <p>Thank you for any help provided.</p>