제목 그대로 파싱한 후 리스트뷰안의 이미지뷰에 서버에서 받은 이미지를 넣어야 하는데..
리스트뷰 목록이 3개가 add되었다 가정하고 첫번째 이미지뷰에는 이미지가 잘 들어갑니다.
근데 2-3번째 이미지는 못받아오고 있어요
소스같이 올리니 도움 부탁드려요
if (file1 != null && file1.length() > 0) {
new GetBitmapTask_Three(MyAdapter_one.image_three_two, file1).execute();
}
public class GetBitmapTask_Three extends AsyncTask<Void, Void, Bitmap> {
private String mUrl;
public GetBitmapTask_Three(ImageView imageView, String url) {
mUrl = url;
}
@Override
protected Bitmap doInBackground(Void... params) {
HttpURLConnection connection = null;
InputStream is = null;
Bitmap retBitmap = null;
try {
Log.e("---------------", mUrl);
URL imgUrl = new URL(mUrl);
connection = (HttpURLConnection) imgUrl.openConnection();
connection.setDoInput(true);
connection.connect();
is = connection.getInputStream();
retBitmap = BitmapFactory.decodeStream(is);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (connection != null) {
connection.disconnect();
}
}
return retBitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if (MyAdapter_one.image_three_two != null) {
MyAdapter_one.image_three_two.setScaleType(ImageView.ScaleType.FIT_XY);
MyAdapter_one.image_three_two.setImageBitmap(bitmap);
}
}
}