我希望从另一个活动中获取传递的值,例如JSONArray、String等多种类型。但是我找不到检索ArrayList值的方法。
我尝试过以下类似的方法,但没有成功:
ArrayList<JSONObject> poiArr;
JSONArray jsonPoints;
try {
poiArr = new ArrayList<JSONObject>(bundle.getSparseParcelableArray("poiArr"));
//here is the problem
} catch (Exception e) {
e.printStackTrace();
}
try {
jsonPoints = new JSONArray(bundle.getString("lesPoints"));
} catch (JSONException e) {
e.printStackTrace();
}
我有这个错误消息:
有什么意见吗?java.lang.NullPointerException:尝试在null对象引用上调用接口方法 'java.util.Collection.toArray()的对象[] java.lang.Object'