float NormValue = value*80 ;
float color = Color.argb(0xFF, NormValue, 0, 0);
This is a part of my code. This variable (NormValue) stores the result in float . But in second line i cannot use this variable since it has to be converted to int. How can i do it. Any help?
Try this..
No need to typecast float
to int
just use Math.round()
float NormValue = value*80 ;
float color = Color.argb(0xFF, Math.round(NormValue), 0, 0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With