Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can clear the value of TextView?

The value of the TextView is inserted by selecting the Item on List (ArrayList). When I close and open the app again the value in the TextView is still there. There is some way to clear the value of TextView?

like image 264
HaOx Avatar asked Jan 27 '12 17:01

HaOx


People also ask

How do you delete text messages on an android?

Tap the conversation. Touch and hold the message you want to delete. Optional: To delete multiple messages, touch and hold the first message, then tap more messages. Tap Delete to confirm.

How do I change the content of TextView?

Set the TextView text programmatically You can also set the TextView 's text attribute programmatically in your Activity class. Inside the Activity class where you want to set the text, find the TextView using the findViewById() method. Then, use the setText() method to set the new text.

How do I know if TextView Ellipsized?

getLineCount(); if ( lines > 0) if ( l. getEllipsisCount(lines-1) > 0) Log. d(TAG, "Text is ellipsized"); } } });

What is TextView control?

A TextView displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing.

How do you get 3 dots at the end of a TextView text?

You are applying to your TextView a compound Drawable on the right.. to make the three dots appear in this scenario, you have to apply a android:drawablePadding="{something}dp" attribute to the TextView as well. Hope it helps!

What is difference between TextView and edit?

EditText is used for user input. TextView is used to display text and is not editable by the user. TextView can be updated programatically at any time.


2 Answers

TextView myTextView = (TextView) findViewById(R.id.myTextView);
myTextView.setText("");
like image 105
Jake Wilson Avatar answered Oct 24 '22 13:10

Jake Wilson


If you would like for your hints to show in the fields, don't set the TextView text to an empty string; instead, set it to null.

TextView myTextView = (TextView) findViewById(R.id.myTextView);
myTextView.setText(null);
like image 28
BluJ IT Avatar answered Oct 24 '22 13:10

BluJ IT