이번에 Open API를 통해서 리스트에 뿌려주는 걸 만들고 있는데요.
각 글에는 이미지가 있을 수도 있고 없을 수도 있습니다.
있을 경우에는
이미지 | 글~~
이런 형태구요. 이미지가 없을 때는
글~~
만 나오게 하고 있습니다.
API에서 10개의 글을 가져오는데 그중에 이미지를 가지고 있는 글은 1개임에도 불구하고, 똑같은 이미지가 다른 게시글( 이미지가 없는)에 추가되어 나옵니다.
이미지 추가 방식은
public Bitmap loadProfileImgByURLForThread( String url ) {
Bitmap bm = null;
Bitmap resizeBm = null;
HttpURLConnection conn = null;
InputStream is = null;
BufferedInputStream bis = null;
try {
URL imgURL = new URL(" url );
conn = (HttpURLConnection)imgURL.openConnection();
conn.connect();
is = conn.getInputStream();
bis = new BufferedInputStream( is );
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
bm = BitmapFactory.decodeStream( bis );
resizeBm = Bitmap.createScaledBitmap(bm, 100, 100, true);
}catch (Exception e) {
e.printStackTrace();
} finally {
if( bis != null ) try { bis.close(); } catch (Exception e2) {}
if( is != null ) try { is.close(); } catch (Exception e2) {}
if( conn != null ) try { conn.disconnect(); } catch (Exception e2) {}
}
return resizeBm;
}
이런 소스로 만들었습니다.
뭔가 버퍼 같은곳에 저장하고 버퍼가 지워지지 않아 그런것 같은데...
무슨 방법이 없을까요?ㅜㅜ
아래의 블로그글을 참고 하시면 좋을듯 하군요.
이러한 비슷한 질문이 좀 많이 올라오는군요..
http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html




해결책을 알고 계시네요. 버퍼를 매번 지우면 됩니다.