Using intents for passing data

前端 未结 5 1025
庸人自扰
庸人自扰 2020-12-12 07:58

How do you send data from one activity to another using intents.

(Note this is a two-part question, the sending and the receiving).

I\'m creating a form, a

5条回答
  •  暖寄归人
    2020-12-12 08:17

    Sending (Activity 1):

    Intent intent = new Intent(MyCurentActivity.this, SecondActivity.class);
    intent.putExtra("key", "enter value here");
    startActivity(intent); 
    

    Receiving (Activity 2):

    String text = getIntent().getStringExtra("key");
    

提交回复
热议问题