title: Android Studio - how do I call a method which references a drawable?
body: <p>This is very much a noob question.</p>
  <p>With the benefit of <a href="https://stackoverflow.com/questions/32797295/how-to-remove-blank-space-around-an-image-in-android">this</a> answer from a different question, I have created a class which theoretically takes a BMP image and resizes it to the size of the image, rather than the (blank) background.</p>
  <p>However, I can't work out how to run the class and reference an image which is saved as a drawable.</p>
  <p>I've tried</p>
  <pre><code>package com.example.trimmer_test;
  import android.media.Image;
  public class Activity_main {
  &quot;@drawable/imagename&quot;
  }
  </code></pre>
  <p>After some searching, I thought that I had to use the getResource method to import the image, so I tried</p>
  <pre><code>package com.example.trimmer_test;
  import android.media.Image;
  public class Activity_main {
  Activity_main.getResource(&quot;@drawable/imagename&quot;)
  }
  </code></pre>
  <p>But this brings up a &quot;cannot resolve symbol 'getResource'&quot; error.</p>
  <p>I've tried what feels like a million variants of this and can't figure it out.</p>
  <p>Apologies for what I imagine is a basic question, but I have searched thoroughly and can't find the answer anywhere.</p>