How to empty edittext without setText(“”);

后端 未结 5 1606
青春惊慌失措
青春惊慌失措 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:41

    if anyone is finding the selected answer not working please try with

    editText.post(() -> editText.getText().clear());
    

    or

    editText.post(new Runnable() {
                @Override
                public void run() {
                    editText.getText().clear();
                }
            });
    

提交回复
热议问题