can not set imageresource
Closed this issue · 1 comments
123pavan123 commented
can not set image resource programetically, if remove src from xml file and try to set src programetically using "scratchimageview.setimageresource" it displays nothing
ccartas commented
It will work if you instantiate ScratchImageView by using findViewById. Please take a look at the snippet below:
ScratchImageView scratchImageView = (ScratchImageView) findViewById(R.id.sample_image);
Resources resources = getResources();
final int resourceID = resources.getIdentifier(b.getString("promoCode"), "drawable", getPackageName());
scratchImageView.setImageDrawable(resources.getDrawable(resourceID, null));