从传递意图数据到其他意图意图、数据

由网友(荒度余生)分享简介:我有两个意图和两个活动秒。我在第一个意图的的EditText 。我想用在的EditText 文本在第二个意图,并传递给第二个意图I want to use the text in the EditText in the second intent and pass to the second intentInt...

我有两个意图和两个活动秒。

我在第一个意图的EditText

我想用在的EditText 文本在第二个意图,并传递给第二个意图

I want to use the text in the EditText in the second intent and pass to the second intent

Intent myIntent = new Intent(mycurentActivity.this, secondActivity.class);
startActivity(myIntent); 

感谢你在前进

推荐答案

您寻找Intent#putExtra(String,字符串)。

下面是一个例子:

Intent myIntent = new Intent(mycurentActivity.this, secondActivity.class);
myIntent.putExtra("key", myEditText.Text.toString();
startActivity(myIntent); 

当您收到的意向,你可以再次提取它:

When your receiving the Intent you can extract it again:

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

(http://developer.android.com/reference/android/content/Intent.html#getStringExtra(java.lang.String))

(http://developer.android.com/reference/android/content/Intent.html#getStringExtra(java.lang.String))

阅读全文

相关推荐

最新文章