我从下面的代码中得到一个例外:
int[] startApps;
JSONObject jsonObjectMapData=new JSONObject(result);
JSONArray jsonaryPlaceMark = jsonObjectMapData.getJSONArray("Apps");
JSONObject apps= jsonaryPlaceMark.getJSONObject(0); int indx=0;
startApps[indx++]=Integer.parseInt(apps.getString("Thread1"));
startApps[indx++]=Integer.parseInt(apps.getString("Thread2"));
我得到 java.lang.NullPointerException 在线:
startApps[indx++]=Integer.parseInt(apps.getString("Thread1"));
服务器响应:
{
"name": "10.000000,106.000000",
"Status": {
"code": 200,
"request": "geocode"
},
"Apps": [ {
"Thread1": 1,
"Thread2": 1,
"Thread3": 1,
"Thread4": 1,
"Thread5": 1,
"Thread6": 1,
"Thread7": 1
} ]
}