private void dataParse(String result){
try{
JSONObject jsonObject = new JSONObject(result);
if ("success".equals(jsonObject.optString("result"))){
JSONArray jsonArray = jsonObject.getJSONArray("rows"){
for (int i =0;i<jsonArray.length();i++){
JSONObject jsonObject1 = jsonArray.getJSONObject(i){
mData.add(new Node(jsonObject1.optString("projectid"),
jsonObject1.optString("parentId"),
jsonObject1.optString("projectname")));
forTree(jsonObject1);
}
mAdapter.addData(mData);
mAdapter.notifyDataSetChanged();
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
private void forTree(JSONObject jsonObject){
try{
if (jsonObject.optString("children").length() !=0 ){
JSONArray jsonArray = jsonObject.getJSONArray("children"){
for (int i =0;i<jsonArray.length();i++){
JSONObject jsonObject1 = jsonArray.getJSONObject(i){
mData.add(new Node(jsonObject1.optString("projectid"),
jsonObject1.optString("parentId"),
jsonObject1.optString("projectname")));
forTree(jsonObject1);
}
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}