我有一个问题或者更好的困境。我必须将JSONObject添加到Global JSONArray,稍后我将从另一个活动中获取此数组。什么是更好的解决方案?
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("strefa", strefa);
jsonObject.put("adres", adres);
jsonObject.put("kryteria", kryteria);
jsonObject.put("telefon", telefon);
jsonObject.put("data", data);
} catch (Exception e) {
e.printStackTrace();
}
GlobalConfig.JsonArray.put(jsonObject); // this is public static JSONArray JsonArray = new JSONArray();
或更好的是在GlobalConfig类中使用私有对象创建一个公共方法?