Convert float to charsequence in android?

I am making a bandwidth calculator where the user enters data and the time it takes to upload or download, and my intention is to display the bandwidth in different units.

However, I cannot find a way to convert the float to CharSequence, so I can add it to my TextView.

Any help is appreciated.

thanks

+4
source share
3 answers

This should do the trick:

string s = Float.toString(myFloat); 
+13
source

String.valueOf(thisIsYourFloat) will work.

+8
source

How about this:

 myFloat+"" 

.-

0
source

Source: https://habr.com/ru/post/1396439/


All Articles