android - JSONArray to String[]? -
How to get the string array from JSONArray?
string [] D; Protected Zero ParseJsonString (ArrayList & lt; string []> DeptList, String Jason) {try {JSONArray array = new JSONArray (json); Int dl = array.length (); Println (dl); For (int i = 0; i & lt; array.label (); i ++) {d [i] = array.getString (i); } DeptList.add (d); For (string e: d) {System.out.println (e); }} Hold (JasonX Express E) {e.printStackTrace (); }} I am debugging this code and I get an error here NullPointerException:
d [i] = array.getString (i );
you forgot
string [] d = New string [array.length]; then the string array D has not been started. And you try to use it on your first element d [i]
Comments
Post a Comment