android/java getIdentifier with
<p>I'm having trouble getting <code>getIdentifier</code> to work with a class variable. It's strange, because this works:</p>

<pre><code>public Drawable getStationIcon(Context context) {
    int resId = context.getResources().getIdentifier("m1m2_16", "drawable", "com.mypackage.namehere");
    Drawable drawable = context.getResources().getDrawable(resId);
    return drawable;
}
</code></pre>

<p>But this doesn't:</p>

<pre><code>public Drawable getStationIcon(Context context) {
    int resId = context.getResources().getIdentifier(this.stationIcon, "drawable", "com.mypackage.namehere");
    Drawable drawable = context.getResources().getDrawable(resId);
    return drawable;
}
</code></pre>

<p>And nor does this:</p>

<pre><code>public Drawable getStationIcon(Context context) {
    String stationI = this.stationIcon;
    int resId = context.getResources().getIdentifier(stationI, "drawable", "com.mypackage.namehere");
    Drawable drawable = context.getResources().getDrawable(resId);
    return drawable;
}
</code></pre>

<p>And <code>this.stationIcon</code> definitely equals <code>m1m2_16</code>. I've tried other alternatives, ie using <code>""+this.stationIcon</code>, but nothing works when the first parameter is a variable. Is there something I'm missing?</p>
