Android check for empty int variable
<p>How can I make this work?</p>

<pre><code>int resId = getResources().getIdentifier("image" + passedVar, "drawable", "com.fnesse.beachguide");

if (resId == null) {
    image.setBackgroundResource(resId);
} else {
    image.setImageResource(R.drawable.defaultimage);
}
</code></pre>

<p>I’m getting the correct response back from getResources and I can display an image but if the image doesn’t exist I would like to display a default image instead of nothing?</p>

<p>Cheers,</p>

<p>Mike.</p>
