Get Value of a Edit Text field

前端 未结 12 922
既然无缘
既然无缘 2020-11-22 07:20

I am learning how to create UI elements. I have created a few EditText input fields. On the click of a Button I want to capture the content typed into that input field.

12条回答
  •  醉话见心
    2020-11-22 08:08

    Get value from an EditText control in android. EditText getText property use to get value an EditText:

    EditText txtname = findViewById(R.id.name);
    String name      =  txtname.getText().toString();
    

提交回复
热议问题