I am working on an android project. I have RGB values of each pixel. I want to create a color object from it.
For android API level 26 and above, we can use Color.valueOf() method which will do the work for us. But it won't support API level below 26. Can someone help me with how I can do this? Thanks in advance.
Unfortunately, this isn't possible. Per the documentation, Color
instances were introduced in Android O, so they aren't available before then. Note also that all of the instance methods on Color
(such as red()
, green()
, blue()
, etc.) are only available on API 26 and above - even if you were able to create an instance, you wouldn't be able to get any information out of it.