4

下面是使用动态列表值构建子级和父级的简单声明。相关代码为createGroupList()createChildList()。我可以操作,TextView但其中一个领域是我的动态图像从加载到JSON不加载WebView

expListAdapter = new SimpleExpandableListAdapter(
            this, createGroupList(),  // Creating group List.
            R.layout.group_row, 
            new String[] { "Group Item" }, 
            new int[] { R.id.`enter code here`row_name },                                                       
            createChildList(),  // Creating Child List.
            R.layout.child_row,                     
            new String[] { "Sub Item0", "Sub Item1", "Sub Item2", "Sub Item3" },                            
            new int[] { R.id.grpChildName, R.id.grpChildAddress, R.id.grpChildPhoneNo, R.id.childImage }                                    
                );
        setListAdapter(expListAdapter);



    private List createGroupList() {
            String header = "";
            int headerSize = 0;
            ArrayList result = new ArrayList();
            for (int i = 0; i < dynamicList.size(); i++) { 
                HashMap m = new HashMap();
                String taxiCompanyData[] = dynamicList.get(i);
                if (header != taxiCompanyData[3]) {
                    m.put("Group Item", taxiCompanyData[3]);                                        
                    header = taxiCompanyData[3];
                    headerList[headerSize] = header;
                    headerSize++;
                    result.add(m);
                    counter++;
                }
            }
            return (List) result;
            }

    Above is Group creating and 

     private List createChildList() {
                ArrayList result = new ArrayList();
                Log.i("Info ", "headerList.length" + headerList.length);
                    for (int i = 0; i < headerList.length; i++) {
                    final ArrayList secList = new ArrayList();
                    System.out.println("dynamic list size is in main"
                            + dynamicList.size());
                     webView = (WebView) findViewById(R.id.childImage);
                    for (int j = 0; j < dynamicList.size(); j++) {
                        String taxiCompanyData[] = dynamicList.get(j);
                        if (taxiCompanyData[3].equalsIgnoreCase(headerList[i])) {
                            final HashMap child = new HashMap();
                            child.put("Sub Item0", taxiCompanyData[0]);
                            child.put("Sub Item1", taxiCompanyData[1]);
                            child.put("Sub Item2", taxiCompanyData[2]);
    //                      child.put("Sub Item3",  taxiCompanyData[4]); 
                            Thread th = new Thread(){
                                @Override
                                public void run() {
                                    webView.loadUrl("https://lh5.googleusercontent.com/-u8heQyD_4y4/T5VMu-Zc6wI/AAAAAAAi71s/EP32a3D-fc0/s90/Corsino");
                                    secList.add(child);
                                };

                            };
                            th.start();

                        }
                    }

                    result.add(secList);
                }
                return (List)result;
            }

我无法加载WebUI。请帮助任何人。

4

0 回答 0