我必须参加AnswerQuestion.java
和SendAnswerToServer.java
活动,我想将数据从第一个活动发送到另一个活动
在AnswerQuestion活动上我写了这个:
Bundle basket = new Bundle();
basket.putString("time", timeToAnswer+"");
Intent goToSendServer = new Intent(AnswerQuestion.this, SendAnswerToServer.class);
goToSendServer.putExtras(basket);
startActivity(goToSendServer);
我的问题我在SendAnswerToServer活动上写了什么,谢谢
答案 0 :(得分:11)
:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = this.getIntent().getExtras();
if(bundle !=null)
{
//ObtainBundleData in the object
String strdata = bundle.getString("time");
//Do something here if data received
}
else
{
//Do something here if data not received
}