문제

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?

도움이 되었습니까?

해결책

TextView myTextView = (TextView) findViewById(R.id.myTextView);
myTextView.setText("");

다른 팁

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);

For that TextView use

android:text=""

in the layout

or user textView.setText("") in the oncreate() method for the activity where textView is the TextView object retrieved from findViewById()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top