开发者

Pass Text Between Activities [duplicate]

开发者 https://www.devze.com 2023-02-25 14:12 出处:网络
This question already has answers here: 开发者_如何学JAVA Closed 11 years ago. Possible Duplicate:
This question already has answers here: 开发者_如何学JAVA Closed 11 years ago.

Possible Duplicate:

Passing data between activities in Android

How can I edit text in my Activity, then pass this text by an intent to a new Activity?


You can pass extra data via the intent using intent.putExtra("key", text_field.getText().toString()) on the intent before you send it (in the first activity) and getIntent().getExtras().getString("key") in the second activity.

This is assuming text_field is your EditText you want to pass the value from. You can change "key" to whatever you want, too.

0

精彩评论

暂无评论...
验证码 换一张
取 消