12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
编程知识 时间:2024-12-04 12:25:55
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
在Android中,可以使用Bundle类来传递数组。首先,将数组放入Bundle中,然后将Bundle传递给Intent对象,最后在接收方从Intent对象中获取Bundle并取出数组。示例代码如下:发送方:Strin
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
在Android中,可以使用Bundle类来传递数组。首先,将数组放入Bundle中,然后将Bundle传递给Intent对象,最后在接收方从Intent对象中获取Bundle并取出数组。
示例代码如下:
发送方:
String[] array = {"item1", "item2", "item3"};Bundle bundle = new Bundle();bundle.putStringArray("myArray", array);Intent intent = new Intent(this, ReceiverActivity.class);intent.putExtras(bundle);startActivity(intent);
接收方:
Bundle bundle = getIntent().getExtras();String[] array = bundle.getStringArray("myArray");// 现在你可以使用获取的数组array进行操作
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19