我应该如何从android中使用Thread
加载http图像? 我想在等待图像加载时显示布局。使用线程加载图像formURL
现在,我使用此代码显示从http我的IMG,它显示了一些时间深色空白屏幕前显示结果:
private Drawable ImageOperations(Context ctx, String url, String saveFilename) {
try {
InputStream is = (InputStream) this.fetch(url);
Drawable d = Drawable.createFromStream(is, "src");
return d;
} catch (MalformedURLException e) {
return null;
} catch (IOException e) {
return null;
}
}
public Object fetch(String address) throws MalformedURLException,IOException {
URL url = new URL(address);
Object content = url.getContent();
return content;
}
谁能帮助我?
请修复您的问题。即使你的英语不是最好的,你也可以修改你的语言(错别字,缺少空格,用大写字母开始你的句子,用'。'等结束它)。 ''是什么意思?这是你提出一个问题的暗示吗?这不是neccessairy我相信... –
Nanne
2012-02-20 13:44:36
谢谢你的建议,是的,我知道有很多从我。保持学习 – rage 2012-02-20 14:12:51