2016-02-05 95 views
0

图像不能在我已经使用setImage()和的getImage(该List.In父类中所示),但我不知道如何让图像ExpandableListMain(这是MainActivity)图像不能显示在列表中

private ArrayList<Parent> buildDummyData(String result) throws JSONException { 
    // Creating ArrayList of type parent class to store parent class objects 
    JSONArray json = new JSONArray(result); 
    ArrayList<Parent> list = new ArrayList<>(); 

    for (int i = 1; i < json.length(); i++) { 

     JSONObject obj1 = json.getJSONObject(i); 
     Parent parent = new Parent(); 
     parent.setName("" + i); 
     // parent.setImage(obj1.getImage("image"));----->this line shows an error 
     parent.setText1(obj1.getString("name")); 
     parent.setChildren(new ArrayList<Child>()); 
     Child child = new Child(); 
     child.setName("" + i); 
     child.setText1(obj1.getString("name")); 
     child.setText2(obj1.getString("mobile")); 
     child.setText3("hellooo"); 
     child.setText4(obj1.getString("blood")); 

     //Add Child class object to parent class object 
     parent.getChildren().add(child); 
     list.add(parent); 
    } 
    return list; 

回答