How do I set a drawable as the background for a list view in a class?
if (array1.size() < 8) { lv1.setBackgroundDrawable(R.drawable.bgimghs2b); }
That's because you're not giving it a Drawable, but an ID of a drawable. Try:
Drawable
lv1.setBackgroundDrawable(getResources().getDrawable(R.drawable.bgimghs2b))
If you're in an activity. If not, then you need to get a Context and call getResources() on that.
Context
getResources()