protected Bitmap doInBackground(String...params) {
// TODO Auto-generated method stub
try {
/* Open a new URL and get the InputStream to load data from it. */
URL aURL = new URL(params[0]);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
/* Buffered is always good for a performance plus. */
BufferedInputStream bis = new BufferedInputStream(is);
/* Decode url-data to a bitmap. */
Bitmap bm = BitmapFactory.decodeStream(bis);
b1=bm;
bis.close();
is.close();
} catch (IOException e)
{
Log.e("DEBUGTAG", "Remote Image Exception", e);
}
return null;
}
// TODO Auto-generated method stub
super.onPostExecute(result);
i1.setImageBitmap(b1);
Animation rotation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.rotate);
i1.startAnimation(rotation);
//System.out.println("imageview is working");
try {
System.out.println("thread going to sleep");
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i1.setImageBitmap(b1);
}
我正在通过位图在图像视图中显示来自互联网的图像现在我通过更新 url 获得了另一个图像这个位图但是我无法显示这个图像只有前一个图像显示,如果我在一个仅循环显示最后一张图片?任何建议