How to empty edittext without setText(“”);

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

    you can use following way

    Kotlin:

    myEditText.text.clear()
    

    Java:

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

提交回复
热议问题