在android中使用bundle传递数组 [英] passing arrays using bundle in android
本文介绍了在android中使用bundle传递数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一个字符串/整数值数组从一个活动传递到另一个活动.我如何实现这一目标?
I need to pass an array of String/integer values from one Activity to another. How do I achieve this?
推荐答案
在活动 A:
String[] abc;
Bundle bundle =new Bundle();
bundle.putStringArray("some string",abc);
在您想要获取代码的活动 B 中:
In Activity B where you want to get give the code as:
String abcd[]=bundle.getStringArray("some string");
some string"在两种情况下都应该相同.
"some string" should be same in both case.
这篇关于在android中使用bundle传递数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文