将二维数组传递给另一个活动 [英] Pass 2D array to another Activity
本文介绍了将二维数组传递给另一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何将 2 个宗派数组对象作为参数传递给另一个活动
how do i pass 2 denominational array object as a parameter to another activity
如何在另一个活动中获取二维数组字符串值
how to get two dimensional array string value in another activity
String [][]str;
Intent l = new Intent(context,AgAppMenu.class);
l.putExtra("msg",str);
l.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(l);
another Activity class
String[][] xmlRespone2;
xmlRespone2 = getIntent().getExtras().getString("msg");
推荐答案
您可以使用 putSerializable. 数组是可序列化的.
You can use putSerializable. Arrays are serializable.
存储:
bundle.putSerializable("list", selected_list);
//这里bundle 是Bundle 对象.
bundle.putSerializable("list", selected_list);
// Here bundle is Bundle object.
访问:
String[][] passedString_list = (String[][]) bundle.getSerializable("list");
示例
Intent mIntent = new Intent(this, Example.class);
Bundle mBundle = new Bundle();
mBundle.putSerializable("list", selected_list);
mIntent.putExtras(mBundle);
这篇关于将二维数组传递给另一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文