title: How to pass a Drawable into a class?
body: <p>Is there anyway to pass a <code>Drawable</code> through a class like so:</p>
  
  <pre><code>public loadImage(Context context, int drawable, int x, int y, int width, int height) {
      this.drawable = context.getResources().getDrawable(drawable);
      this.x = x;
      this.y = y;
      this.width = width;
      this.height = height;
  }
  </code></pre>
  
  <p>Trying to pass the <code>Drawable</code> into the class:</p>
  
  <pre><code>candyImg = new loadImage(getContext(), getResources().getDrawable(R.drawable.candy), 0, 0, 50, 50);
  </code></pre>
  
  <p>It says <code>getResources().getDrawable(drawable);</code> is deprecated. So how can I pass a <code>Drawable</code> through a class like so.</p>