How I can clear the value of TextView?

雨燕双飞 提交于 2019-12-05 02:41:39
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()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!