Clear text in EditText when entered

后端 未结 18 1691
醉话见心
醉话见心 2020-11-27 03:44

I\'m trying to set and onclicklistener so that when I click within the edittext element it will clear its current contents. Is there something wrong here? When I compile thi

18条回答
  •  旧时难觅i
    2020-11-27 04:43

    We can clear EditText data in two ways

    First One setting EditText is empty like below line

    editext.setText("");
    

    Second one clearing EditText data like this

    editText.getText().clear();
    

    I suggest second way

提交回复
热议问题