set image with setImageResource in Android Studio using a variable
<p>I am trying to set my image in my ImageView through a variable (item is the variable name, which I will be setting to lowerCase).
However, it is not working and resID will return 0.</p>

<p>Here is my code:</p>

<pre><code>    ImageView iv = (ImageView)v.findViewById(R.id.imgView);

    if (item != null) {
        Log.i("item: ", item.toLowerCase());

        int resID = getResources().getIdentifier(item.toLowerCase(), "drawable", "package.name");

        Log.i("resid: ", String.valueOf(resID)); //will return 0 - im guessing this is where the problem is

        iv.setImageResource(resID);
    }
</code></pre>

<p>I used this as a guide <a href="https://stackoverflow.com/questions/7941304/android-reference-things-in-r-drawable-using-variables">Android, reference things in R.drawable. using variables?</a> but none of the other solutions work for me, in fact they all gave me the same result (returning 0). 
I can provide more code if needed (just didn't want it to be bombastic).
Thanks in advance!</p>