How to pass edit text data in form of string to next activity?

前端 未结 4 2046
醉话见心
醉话见心 2020-12-09 05:39

I am developing an android application in which i have taken two buttons and one edit text box. i want to pass the data of edit text box in from of string to the next activi

4条回答
  •  难免孤独
    2020-12-09 05:57

    Inside your Button's onClick Listener try the following,

    String str=editText.getEditableText().toString();
    

    Now use your intent,

    Intent intent=new Intent(this,nextActivity.this);
    intent.putExtra("editText_value",str);
    startActivity(intent);
    

提交回复
热议问题