I want to display a float into Text View
TextView is the user interface which displays the text message on the screen to the user. It is based on the layout size, style, and color, etc. TextView is used to set and display the text according to our specifications.
Set the Text of Android TextView Following is another way to set the text of textview control programmatically in activity file using setText() method. TextView tv = (TextView)findViewById(R. id. textView1);
Textview : should be used for uneditable text which user wants to read but not to manipulate. e.g. News, Articles, Blogs. Plain text/ Edittext : should be used for taking user input in alphanumeric form. e.g. UserId, Comments.
Try this :
float myfloatvariable=(float) 2.33333;
String mytext=Float.toString(myfloatvariable);
TextView.setText(mytext);
Try this
myTextView.setText(Float.toString(floatVar));
myTextView.setText(String.valueOf(floatVar));
myTextView.setText(floatVar+"");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With