Android 如何用gallery批量显示网络图片.弄成那种在线浏览网页的图片.
发布网友
发布时间:2022-05-02 16:56
我来回答
共1个回答
热心网友
时间:2023-10-09 00:42
/*
*
*/
private class downloadImage extends AsyncTask<String, Integer, Bitmap> {
Bitmap[] bms;
@Override
protected Bitmap doInBackground(String... arg0) {
// TODO Auto-generated method stub
bms = new Bitmap[arg0.length];
for (int i = 0; i < arg0.length; i++) {
Bitmap bm = Common.GetImages(arg0[i], "219.136.252.234");
bms[i] = bm;
publishProgress(i);
}
return null;
}
@Override
protected void onProgressUpdate(Integer... values) {
// TODO Auto-generated method stub
adapter = new ImageAdapter(Activity_Gallery.this, bms);
galleryFlow.setAdapter(adapter);
adapter.notifyDataSetChanged();
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Bitmap result) {
// TODO Auto-generated method stub
adapter = new ImageAdapter(Activity_Gallery.this, bms);
galleryFlow.setAdapter(adapter);
adapter.notifyDataSetChanged();
galleryFlow.setSelection(5, true);
setGalleryMovie(true);
super.onPostExecute(result);
}
}追问恩 不错 用这个AsyncTask 进行的处理 非常感谢你的回复.. 看来我要好好研究研究这个AsyncTask了