传递整个 ArrayList<String>在android中从一项活动到另一项活动 [英] passing Entire ArrayList<String> from one activity to other in android
本文介绍了传递整个 ArrayList<String>在android中从一项活动到另一项活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将一个 ArrayList 从一个活动传递到另一个活动.我发现此链接用于将arraylist从一个活动传递到另一个活动很有用.
I want to pass a ArrayList from one activity to other. I have found this link for pass arraylist from one activity to other useful.
但是当我使用
ArrayList<String> hyperlinks = new ArrayList<String>();
...
Intent myIntent=new Intent(Player.this,VideoActivity.class);
Bundle mBundle = new Bundle();
mBundle.putStringArrayListExtra("hyperlinks", hyperlinks);
//mBundle.putString("filePath", hyperlinks.get(0));
myIntent.putExtras(mBundle);
Player.this.startActivity(myIntent);
然后我在 mBundle.putStringArrayListExtra 遇到错误,说方法 putStringArrayListExtra(String, ArrayList) 对于类型 Bundle 来说是未定义的
Then I am getting error at mBundle.putStringArrayListExtra , Saying that The method putStringArrayListExtra(String, ArrayList) is undefined for the type Bundle
请指导我怎么做??
谢谢
推荐答案
有很多方法可以做到,但您是否尝试过:
There's lots of ways to do it, but have you tried:
myIntent.putStringArrayListExtra(key, hyperlinks);
此外,Bundle 对象具有
Also, the Bundle object has
putStringArrayList
这篇关于传递整个 ArrayList<String>在android中从一项活动到另一项活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文