감사합니다...한가지만 더 여쭤봐도될련지요..!
제가 이미지를 가져와서 listview,에 넣고 싶은데..이미지를 가져왔는데..
simpleadapter에 들어가질 않네요!!
private Bitmap[] GetImageFromURL() {
System.out.println("이미지 가져오기..!");
imgBitmap = new Bitmap[str.length];
//img = new ImageView[str.length];
//인터넷 연결을 위해 try/catch를 한다.
try {
for (int i = 0; i < str.length; ++i) {
// url 등록
URL url = new URL("str[i]);
URLConnection conn = url.openConnection();
// 모르겟다..
// conn.setConnectTimeout(5000);
// conn.setUseCaches(false);
conn.connect();
int nSize = conn.getContentLength();
// 접속한 url로부터 데이터값을 받아온다.
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(), nSize);
// 얻어온 이미지를 bitmap에 저장
imgBitmap[i] = BitmapFactory.decodeStream(bis);
Log.i("index", ""+imgBitmap[i]);
// BufferedInputStream 종료
bis.close();
} // for문 종료
} catch (Exception e) {
e.printStackTrace();
}
return imgBitmap;
}
이미지를 가져오는 소스입니다..ㅠ
2일동안 하고 있는데 이미지를 못넣네요..답변부탁드립니다..!
리스트뷰에 설정한 아답터의 메소드 중 데이터가 변경되었을 경우 새로고침하라는 메소드가 있습니다.
notifyDataSetChanged();
이것을 해줘야 리스트뷰가 갱신되죠.
데이터만 넣는다고 알아서 업데이트 되진 않습니다.