How to empty edittext without setText(“”);

后端 未结 5 1608
青春惊慌失措
青春惊慌失措 2021-01-07 20:24

Is there a way to reset the edittext value without setting text like:

((EditText) findViewById(R.id.yoursXmlId)).setText(\"\");

EDI

5条回答
  •  孤街浪徒
    2021-01-07 20:47

    Another option is: EditText.getText().clear(); But you'll have to cast anyway:

    ((EditText) findViewById(R.id.yoursXmlId)).getText().clear();

提交回复
热议问题