title: Using Android getIdentifier()
body: <p>I've tried this:</p>
  
  <pre><code>r = Resources.getSystem().getIdentifier("ball_red","drawable","com.Juggle2");
  Log.i("FindBall","R = "+r);
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>r = Resources.getSystem().getIdentifier("com.Juggle2:drawable/ball_red", null, null);
  </code></pre>
  
  <p>But 'r' always ends up as zero.</p>
  
  <p>I'm calling this line from inside a helper class that's not an Activity and doesn't extend anything, so I can't simply call <code>getResources()</code>, but I can pass it from my <code>SurfaceView</code>.</p>
  
  <p>Eventually, I want to replace <code>"ball_red"</code> with a variable, but first thing's first. This isn't working.</p>
  
  <p><code>com.Juggle2</code> is indeed my package name. <code>drawable</code> is the <code>res</code> folder that it's in, and, the name of the file is indeed <code>ball_red</code>.</p>
  
  <p>R.java says:</p>
  
  <pre><code>        public static final int ball_red=0x7f020027;
  </code></pre>
  
  <p>So I'm not sure why it isn't working.</p>
  
  <hr>
  
  <p>So I can't use Resources, I must pass a context, and I'm doing that this way:
  Inside here:</p>
  
  <pre><code>class Collection extends SurfaceView implements SurfaceHolder.Callback {
  </code></pre>
  
  <p>I'm making a new instance of my class and passing it <code>getContext()</code> as a parameter.</p>