I have to change tint color of imageview but programmatically. I will be getting a string value from server for eg:
"color":"#fff"
I have to set the same color as tint to an imageview.
The following code will not work =, as the image present in imageview is not set as background of it, but as src.
imageView.getBackground().setColorFilter(Color.parseColor("#ff8800"), PorterDuff.Mode.SRC_ATOP);
Also, these are following i tried with no luck. :( Attempt1:
ImageViewCompat.setImageTintList(imageView, ColorStateList.valueOf(Integer.parseInt("#ffffff")));
Attempt2:
imageView.setColorFilter(ContextCompat.getColor(context, Color.parseColor("#ffffff")), android.graphics.PorterDuff.Mode.SRC_IN);
Attempt3:
imageView.setColorFilter(ContextCompat.getColor(context, R.color.______), android.graphics.PorterDuff.Mode.MULTIPLY);
Kindly Note, I cannot use R.color.SOMETHING ,as i dont have that color in my file.
Thanking in advance.