在机器人的ImageView在ExpandableListView从WEBURL加载图像 [英] Load image from webUrl at ImageView in ExpandableListView in android

查看:226
本文介绍了在机器人的ImageView在ExpandableListView从WEBURL加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目,我使用谷歌的WebService中对此我quering like--医院,电影院,度假等不同的查询,以获取导致JSON格式。
从JSON我得到这样的名称如此多的数据,纬度,经度,图片网址,在各自的查询网页URL。而我manupulating这些数据,并显示在我的ListView扩展它。我能够做的节目的所有数据,但是当我在ImageView的图像加载它显示了一些不匹配。加载图像,我使用ImageLoader的,FileCache,和的MemoryCache utils的Java类。
基本上,问题是,我有一个形象的web网址,现在我想表明它在我的ListView扩展ImageView的,和我没有正确执行它。请任何好友的帮助。

In my project i am using google webService in which i am quering different query like-- hospital, cinema hall, resort etc. and get result in json format . From json i get so many data like Name, lat, lng, imageUrl, Web url in respective query. And i am manupulating these data and showing it in my Expandable listView. I am able to do show all data but when i am loading image on ImageView it is showing some mismatch. For loading image, I am using ImageLoader, FileCache, MemoryCache and Utils java class. Basically question is i have http web url for image and now i want to show it on my ImageView at Expandable listView, and i am not properly perform it. Please any buddy help.

推荐答案

Tikam完成后,尝试使用这个类,

Tikam done, try to use this class,

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;



    /**
     * 
     * @author JSR
     *
     */

 public class StreamUtils {

/**
 * A helper method to convert an InputStream into a String
 * @param inputStream
 * @return the String or a blank string if the IS was null
 * @throws IOException
 */
public static String convertToString(InputStream inputStream) throws IOException {
    if (inputStream != null) {
        Writer writer = new StringWriter();

        char[] buffer = new char[1024];
        try {
            Reader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 1024);
            int n;
            while ((n = reader.read(buffer)) != -1) {
                writer.write(buffer, 0, n);
            }
        } finally {
            inputStream.close();
        }
        return writer.toString();
    } else {
        return "";
    }
}
 }

这篇关于在机器人的ImageView在ExpandableListView从WEBURL加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆