如何让二维字符串数组从一个活动到其他 [英] how to get two dimensional string Array from one Activity to other
本文介绍了如何让二维字符串数组从一个活动到其他的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的Android。请告诉我怎么去二维字符串数组从一个活动到另一个活动。 谢谢
I am new to Android. Please tell me how to get two dimensional string Array from one Activity to other Activity. Thank You
推荐答案
我可以给你最简单的答案,做一个序列化类的getter和setter,并在任何地方使用你的数据,你的应用程序:
I can give you the simplest answer, Make a Serializable Class for getter and setter and use your data anywhere in your application as:
Class ABC implements Serializable
{
private static final long serialVersionUID = 1L;
String[][] str;
private static ABC singletonObject;
public static ABC getSingletonObject() {
if (singletonObject == null) {
singletonObject = new ABC ();
}
return singletonObject;
}
public void setString(String[][] str)
{
this.str = str;
}
public String[][] getString()
{
return str;
}
}
你要跟可以将其设置为
Yous can set it as
ABC s = ABC.getSingletonObject();
s.setString(str);
在另一个活动
In another activity
ABC s = ABC.getSingletonObject();
String[][] str = s.GetString();
和享受
and enjoy
这篇关于如何让二维字符串数组从一个活动到其他的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文