Android 如何将更多参数传递给其他活动?
如何传递多于1个参数以传递另一个活动? 我以这种方式将我的2D字符串作为参数传递,传递成功,但现在我想要两个传递更多的参数。现在使用bean类如何发送Android 如何将更多参数传递给其他活动?,android,Android,如何传递多于1个参数以传递另一个活动? 我以这种方式将我的2D字符串作为参数传递,传递成功,但现在我想要两个传递更多的参数。现在使用bean类如何发送 Intent j = new Intent(AgAppTransUtilityBalanceInquiry.this, AgAppTransUBIResponse.class); MyBean bean = new MyBean(); bean.set2DArray(xmlResponse);
Intent j = new Intent(AgAppTransUtilityBalanceInquiry.this, AgAppTransUBIResponse.class);
MyBean bean = new MyBean();
bean.set2DArray(xmlResponse);
Bundle b = new Bundle();
b.putSerializable("mybean", bean);
j.putExtra("obj", b);
and get like this
Bundle b = getIntent().getBundleExtra("obj");
MyBean dData = (MyBean) b.getSerializable("mybean");
xmlResponse =dData.get2DArray();
public class MyBean implements Serializable{
String[][] data = null;
public void set2DArray(String[][] data){
this.data = data;
}
public String[][] get2DArray(){
return data;
}
}
but i want pass two more parameters
b.putString("otheraccount", otheraccount.getText().toString());
b.putString("choicess" ,(String)provider.getSelectedItem());
how do i pass this two more parameters seprately??
你可以使用intent.putextras();它怎么不起作用?传递2个参数是按照您编写的方式完成的,但它在调试模式下不显示值?我使用Bundle b=getIntent().getBundleExtra(“obj”)在另一个活动中获取1个参数;MyBean dData=(MyBean)b.getSerializable(“MyBean”);xmlResponse=dData.get2DArray();此代码