Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert float to CharSequence in android?

I am making a throughput calculator where the user inputs data and the duration it took to download or upload and my intention is to display the throughput in varying units.

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

Any help is appreciated.

Thanks

like image 395
Parth Avatar asked Feb 14 '12 17:02

Parth


2 Answers

This should do the trick:

string s = Float.toString(myFloat);
like image 70
Unknown1987 Avatar answered Oct 05 '22 08:10

Unknown1987


String.valueOf(thisIsYourFloat) will work.

like image 24
CommonsWare Avatar answered Oct 05 '22 08:10

CommonsWare