How to get text from EditText?

前端 未结 7 1943
旧时难觅i
旧时难觅i 2021-01-01 12:21

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

    Place the following after the setContentView() method.

    final EditText edit =  (EditText) findViewById(R.id.Your_Edit_ID);
    String emailString = (String) edit.getText().toString();
    Log.d("email",emailString);
    

提交回复
热议问题