我在上一條語句中獲得NullPointerException
。請幫助。ArrayList哈希表空指針異常
ArrayList<HashMap<String, String>> contactList;
for(int i=0; i < jsonArray.length(); i++){
JSONObject jsonObject = jsonArray.getJSONObject(i);
HashMap<String,String> contact = new HashMap<String,String>();
contact.put(TAG_ID, jsonObject.optString("id").toString());
contact.put(TAG_NAME,jsonObject.optString("name").toString());
contact.put(TAG_EXT,jsonObject.optString("extension").toString());
contactList.add(contact);
}
的[什麼是空指針異常,怎麼解決呢?(http://stackoverflow.com/questions/可能的複製218384/what-is-null-pointer-exception-and-how-do-i-fix-it) –