Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not set imageresource #7

Closed
123pavan123 opened this issue Oct 16, 2017 · 1 comment
Closed

can not set imageresource #7

123pavan123 opened this issue Oct 16, 2017 · 1 comment

Comments

@123pavan123
Copy link

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
Copy link

ccartas commented Nov 28, 2017

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));

@sharish sharish closed this as completed Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants