在Android中使用束传递数组 [英] passing arrays using bundle in android

查看:174
本文介绍了在Android中使用束传递数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从一个活动传递字符串/整数数组到另一个。我如何做到这一点?

I need to pass an array of String/integer values from one Activity to another. How do I achieve this?

推荐答案

在活动答:

String[] abc;

Bundle bundle =new Bundle();
bundle.putStringArray("some string",abc);

在活动B,其中你想获得给code为:

In Activity B where you want to get give the code as:

String abcd[]=bundle.getStringArray("some string");

一些字符串应该是在这两个情况相同。

"some string" should be same in both case.

这篇关于在Android中使用束传递数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆