gpt4 book ai didi

android - 在android Activity 之间传递字符串数组

转载 作者:IT老高 更新时间:2023-10-28 22:04:24 24 4
gpt4 key购买 nike

我在 First Activity - A 中有 2 个字符串数组,现在我需要将两个数组都传递给 second_activity - B,我该怎么做?

我知道 Android 中的 Intent 类概念,并且已经将单个变量值传递给另一个 Activity ,但我还没有实现传递字符串数组的概念在 Activity 之间,我已经上网了。

请告诉我可能的解决方案。

最佳答案

Bundle b=new Bundle();
b.putStringArray(key, new String[]{value1, value2});
Intent i=new Intent(context, Class);
i.putExtras(b);


希望对您有所帮助。

为了阅读:

Bundle b=this.getIntent().getExtras();
String[] array=b.getStringArray(key);

关于android - 在android Activity 之间传递字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4429036/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com