Imageadapter和listview与json的图像

时间:2014-02-18 21:40:30

标签: android image listview

我还有一个关于在json对象的listview上显示图像的问题。我在stackoverflow上检查了几乎所有可能的答案,但没有找到任何解决方案。我有以下实施

                contact = json.getJSONArray(TAG_CONTACT);
                for(int i = 0; i < contact.length(); i++){
                    JSONObject c = contact.getJSONObject(i);
                    //put json obkject on variable
                    String fname = c.getString(TAG_NAME);
                    String uname = c.getString(TAG_UNAME);
                    String type = c.getString(TAG_TYPE);
                    String email = c.getString(TAG_EMAIL);
                    String thumb = c.getString(TAG_THUMB);
                    // Adding value HashMap key => value
                    HashMap<String, String> map = new HashMap<String, String>();
                    map.put(TAG_NAME, fname);
                    map.put(TAG_UNAME, uname);
                    map.put(TAG_TYPE, type);
                    map.put(TAG_EMAIL, email);
                    map.put(TAG_THUMB, thumb);
                    contactlist.add(map);
                 // Finding the list view
                    list=(ListView)findViewById(R.id.contactlist);
                    ImageLoader imgLoader = new ImageLoader(getApplicationContext());



                 // Put data on listview content
                    ListAdapter adapter = new SimpleAdapter(ContactPage.this, contactlist,
                            R.layout.contact_list,
                            new String[] {TAG_NAME,TAG_UNAME,TAG_TYPE,TAG_EMAIL,TAG_THUMB}, new int[] {
                                    R.id.contact_name,R.id.contact_usertype,R.id.contact_status,R.id.contact_email,R.id.contact_image});
                    list.setAdapter(adapter);

如果我在拇指上有图片网址,即c.getString(TAG_THUMB);

,我现在在哪里以及如何在我的代码中实现imgLoader.DisplayImage(url, imageView)

提前致谢。

0 个答案:

没有答案