Converting a String to hex for use as canvas paint color Java?

If you need a Color variable, you can use the Color contructor (but have to change the range to 0.0-1.0).

Up vote 0 down vote favorite share g+ share fb share tw.

Void changeColor(int a, int r, int g, int b){ String hex = + Integer. ToHexString(a) + Integer. ToHexString(r) + Integer.

ToHexString(g) + Integer. ToHexString(b); int color = hex //Obviously this is a type mismatch, but how do I do this? Mpaint.

SetColor(color); } Obviously this is a type mismatch, but how do I do this? Java colors hex int link|improve this question edited Jan 3 at 22:56?6,5021325 asked Jan 3 at 22:48charles horvath145 17% accept rate.

If you need a Color variable, you can use the Color contructor (but have to change the range to 0.0-1.0) Color(float r, float g, float b, float a) But if you need an int in the end, you have to use bitshifts (this is an example, you have to know how the color components need to be ordered) : int color = (r.

Actually I found out that the Android SDK for the paint object has a built in color setter in the same format. Mpaint. SetARGB(a, r, g, b); – charles horvath Jan 4 at 0:34.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions