title: Is resource a color or a drawable?
body: <p>I have create a little custom view that extends ImageView.
  My custom view provides a method <code>showError(int)</code>, where I can pass a resource id, which should be displayed as the image views content. It would be great if I could pass a simple color resource id or a drawable resource id.</p>
  
  <p>My problem is: how do I determine if the passed resource id is a Drawable or a Color?</p>
  
  <p>My current approach is something like this:</p>
  
  <pre><code>class MyImageView extends ImageView{
  
       public void showError(int resId){
  
          try{
              int color = getResources().getColor(resId);
              setImageDrawable(new ColorDrawable(color));
          }catch(NotFoundException e){
              // it was not a Color resource so it must be a drawable
              setImageDrawable(getResources().getDrawable(resId));
          }
  
       }
  }
  </code></pre>
  
  <p>Is it safe to do that? My assumption is, that a resource id really unique. I mean not unique in R.drawable or R.color, but completely unique in <code>R</code></p>
  
  <p>So that there is no </p>
  
  <pre><code>R.drawable.foo_drawable = 1;
  R.color.foo_color = 1;
  </code></pre>
  
  <p>Is it correct that the id <code>1</code> will be assigned only to one of this resources but not to both?</p>