How to convert float to int : android

java

Solution

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);

Problem

``` 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?

Original source

Related problems