[英]How can i send Bundle Array value to another activity in android?
如何将 Bundle Array 值发送到 android 中的另一个活动?
我有一个类(sun.java)。它生成捆绑类型数组。我在另一个活动中需要字符串格式的捆绑类型数组。
帮我
提前致谢
Sun.java类`进入
Intent intent=new Intent(PaymentPageActvity.this,CancelPaymentActivity.class);
Bundle b=new Bundle();
b.putBundle("inErrorMessage",inResponse);
Log.i("Error","onTransactionFailure :"+inErrorMessage);
Log.i("Error","onTransactionFailure :"+inResponse);
//intent.putExtras(inResponse);
//app.getLogger().error("Transaction Success :" + inResponse);
intent.putExtras(b);
startActivity(intent);
第二个活动是
Bundle b=CancelPaymentActivity.this.getIntent().getExtras();
Bundle array=b.getBundle("inErrorMessage");
Log.i("array",""+array);
在 logcat 我得到了这个值
onTransactionFailure :Bundle[{INDUSTRY_TYPE_ID=Retail, payt_STATUS=1, ORDER_ID=FCF440, CHANNEL_ID=WAP, CUST_ID=48, ORDER_PHONE=7428453915, REQUEST_TYPE=DEFAULT, ORDER_EMAIL=singhamit1632@gmail.com, MID=klbGlV59135347348753, THEME=merchant, TXN_AMOUNT=8.0, WEBSITE=paytm, CHECKSUMHASH=PM5h/19blmHQyxBe2EDkMIi/Xqt5u3uijNMdWLJVzU60co6zhoHqmmFScNZaNVhwqrIm4kd2R6fEaROhFr9xsKtG96MIkymqkhtQ08DG6zQ=}]
您将其放入用于启动 Activity 的 Intent 的 Extras 中。 查看 Intent 类的 Google 文档
您可以通过捆绑对象发送string[]
或ArrayList<String>
如下
Bundle bundle=new Bundle();
bundle.putStringArray("STRING_ARRAY", yourStringArray);
bundle.putStringArrayList("STRING_ARRAY_LIST", stringArrayList);
Intent intent =new Intent(this, YourClass.class);
intent.putExtras(bundle);
希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.