Convert float value to String

I'm programming for android, and I'm trying to display a float value found by the getX() function in a Toast, which only displays String values. How do I do this conversion?

Author: Bandicoot_, 2018-07-01

2 answers

To convert a float value to a string, you can use the String.valueOf():

String str = String.valueOf(<valor float a ser convertido>);
 3
Author: , 2018-07-01 23:14:54

You Can use Java's own Float Class:

String s = Float.toString(25.0f);
 0
Author: Dherik, 2018-07-02 20:03:01