setBackgroundColor()
only takes ints. I don't really know what int equals to what color.
Is there a simple way to convert a string like #2222FF
on runtime into an int
?
Asked
Active
Viewed 3.0k times
44

Christian
- 25,249
- 40
- 134
- 225
1 Answers
114
int color = Color.parseColor("#2222FF");

Konstantin Burov
- 68,980
- 16
- 115
- 93
-
But it is giving me a value like -14540033, i mean minus value, so is it true? – Paresh Mayani Jan 05 '12 at 07:29
-
4@PareshMayani uh, why do you expect it to be positive? It's o.k. I guess. – Konstantin Burov Jan 06 '12 at 15:52