how to set imageview src?
I have an image view and a string src. I want to set the imageview source to the string src that I have, but am unable to do so beacuse the method expects an int:
Since this method takes an int how can I accomplish my goal of using a string?
2 Solutions collect form web for “how to set imageview src?”
Each image has a resource-number, which is an integer. Pass this number to “setImageResource” and you should be ok.
Check this link for further information:
To set image cource in imageview you can use any of the following ways. First confirm your image is present in which format.
If you have image in the form of bitmap then use
If you have image in the form of drawable then use
If you have image in your resource example if image is present in drawable folder then use
If you have path of image then use