Parth
Parth

Reputation: 1266

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

Upvotes: 6

Views: 28659

Answers (3)

Koobecaf Eliforp
Koobecaf Eliforp

Reputation: 48

What about this:

myFloat+""

.-

Upvotes: 0

Unknown1987
Unknown1987

Reputation: 1701

This should do the trick:

string s = Float.toString(myFloat);

Upvotes: 16

CommonsWare
CommonsWare

Reputation: 1006819

String.valueOf(thisIsYourFloat) will work.

Upvotes: 9

Related Questions