我正在使用动态表格布局,因为有图像和 TextView 。数据来自 XML 文档。我想要的是在表中运行时的布局,我必须得到解析的图像和 TextView 。我正在正确获取 textview 但不是图像。我使用方法 LoadImageFromWebOperations
加载图像,但它得到一个类转换异常和错误,如下所示:
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl$LimitedInputStream
什么可能导致异常?
编辑评论中的代码
private Drawable LoadImageFromWebOperations(String friend_image) {
try {
System.out.println("friend_image "+friend_image);
InputStream is = (InputStream) new URL(friend_image).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
return d;
} catch (Exception e) {
System.out.println("Exc at oadImageFromWebOperations "+e);
return null;
}
}
最佳答案
关于java - 从android中的url加载图像时发生类转换异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6151233/