Cześć, mam problem, nie moge obsłużyć wyświetlenia danych w listview, w textview bez problemu wyświetlam pobrany tekst, gdy próbuje wyświetlić to aplikacja przestaje odpowiadać, kombinuje, czytam w internecie duzo i cały czas nie mam pomysłu w czym robię błąd.
załączam kod i błąd;
public void onResponse(JSONObject response) {
try {
JSONArray students = response.getJSONArray("pracownicy");
result.setText("");
for (int i = 0; i < students.length(); i++) {
JSONObject student = students.getJSONObject(i);
String firstname1 = student.getString("firstname");
String lastname1 = student.getString("lastname");
String kat1 = student.getString("kat");
HashMap<String, String> map = new HashMap<String, String>();
map.put("firstname",firstname1);
map.put("lastname", lastname1);
map.put("age", age1);
mCommentList.add(map);
ListAdapter adapter = new SimpleAdapter(MainActivity.this, mCommentList,
R.layout.list_item, new String[] { firstname1,lastname1,age1}, new int[]
{ R.id.editText, R.id.editText2, R.id.editText3 });
list.setAdapter(adapter);
i kod bladu
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rz.mysql, PID: 2821
java.lang.NullPointerException
at com.rz.mysq.MainActivity$1$1.onResponse(MainActivity.java:93)
at com.rz.mysql.MainActivity$1$1.onResponse(MainActivity.java:76)
at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:72)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)