使用意图传递数据意图、数据

2023-09-12 10:41:56 作者:2B风度儿

你如何从一个活动发送数据到另一个使用意图。

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

(注意,这是一个两部分的问题,发送和接收)。

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

我创建一个表单,并且我要救的答案,每一个问题,在SQLite数据库。

I'm creating a form, and I want to save the answers to every question in an sqlite database.

推荐答案

您可以轻松地通过使用捆绑的数据。

You can pass data easily using Bundle.

Bundle b=new Bundle();
b.putString("key", value);

Intent intent=new Intent(TopicListController.this,UnitConverter.class);
intent.putExtras(b);

startActivity(intent);

您可以在其他活动免费获赠这样的数据如下:

You can recieve data in your other activity like this as follow:

Bundle b=this.getIntent().getExtras();
String s=b.getString("select");
 
精彩推荐
图片推荐