【发布时间】:2013-02-01 20:52:08
【问题描述】:
我正在尝试使用以下代码从服务器加载远程图像:
imageViewClient = (ImageView) findViewById(R.id.imageViewClient);
try
{
URL thumb_u = new URL(c.getImage());
Drawable thumb_d = Drawable.createFromStream(thumb_u.openStream(), "src");
imageViewClient.setImageDrawable(thumb_d);
}
catch (Exception e)
{
}
图像显示正常,但是当我将代码放入新线程时,图像未加载。
代码是:
new Thread()
{
@Override
public void run()
{
//** Set imageview url
try {
URL thumb_u = new URL(c.getImage());
Drawable thumb_d = Drawable.createFromStream(
thumb_u.openStream(), "src");
imageViewClient.setImageDrawable(thumb_d);
}
catch (Exception e) {
}
}
}.start();
图片不加载,为什么不加载?
【问题讨论】:
标签: android multithreading image