How to get text from EditText?

前端 未结 7 1500
北恋
北恋 2021-01-01 12:14

The question is quite simple. But I want to know where exactly do we make our references to the gui elements? As in which is the best place to define:

final          


        
相关标签:
7条回答
  • 2021-01-01 12:54
    String fname = ((EditText)findViewById(R.id.txtFirstName)).getText().toString();
    String lname = ((EditText)findViewById(R.id.txtLastName)).getText().toString();
    ((EditText)findViewById(R.id.txtFullName)).setText(fname + " "+lname);
    
    0 讨论(0)
提交回复
热议问题