안녕하세요.

서버에 있는 XML 이미지 경로를 파싱하여 그리드뷰에 보여주는 소스 입니다....

이미지가 안나옵니다.......

안드로이드 시작한지 얼마 안된 왕초보구요........ 책에있는 소스만 공부하다가..... 실제 서버에 있는 이미지를 가져다 작업을 하려니...... 도저히 방법을 못찾겠습니다.......... ㅜㅜ

하단의 빨간색으로 적은것이 문법이 맞는건지, 방법이 틀린건지 궁금합니다.



public class DateReadGalleryAdapter extends BaseAdapter{

 private Context context;
 private LayoutInflater inflater;
 private int layoutId;
 private ArrayList<DateReadGalleryData> galleryDatas; // 이미지 경로만 들어 있는객체 (큰이미지, 썸네일)
 private DateReadGalleryData galleryData;
 private HttpURLConnection conn;
 private InputStream stream;
 private Bitmap image;
 
 
 
 
 private Integer[] mImageResourceIds = {
   R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon, 
   R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon, 
   R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon, 
   R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon, 
   R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon, 
   R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon,R.drawable.icon   
 };
 
 public DateReadGalleryAdapter(Context context, int layoutId, ArrayList<DateReadGalleryData> galleryDatas){
  this.context = context;
  this.inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  this.layoutId = layoutId;
  this.galleryDatas = galleryDatas;
  
  this.galleryData = null;
  this.conn = null;
  this.stream = null;
  this.image = null;
 }
 
 public int getCount() {
  return galleryDatas.size();
 }

 public Object getItem(int position) {
  return position;
 }

 public long getItemId(int position) {
  return position;
 }

 public View getView(int position, View convertView, ViewGroup parent) {
  
  ImageView imageView = null;
  
  if(convertView == null){
//   convertView = inflater.inflate(layoutId, parent, false);
   imageView = new ImageView(context);
   imageView.setLayoutParams(new GridView.LayoutParams(75,75));
   imageView.setAdjustViewBounds(false);
   imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  }else{
   imageView = (ImageView) convertView;
  }
  
  galleryData = galleryDatas.get(position);

//  1. 소스 입니다.... 서버의 이미지경로(http://www...........) 가 있습니다.
//  여기서 궁금한것은  imageView.setImageBitmap(image);      해당 함수를 풀이하면
//  imageView.setImageBitmap(http://www................................................);    저렇게 들어가는데....... 해당 문법이 맞는건가요?

try {
   URL url = new URL(galleryData.getImgSmall());
   conn = (HttpURLConnection)url.openConnection();
   
   if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
    stream = conn.getInputStream();
    image = BitmapFactory.decodeStream(stream);
    if(image != null) imageView.setImageBitmap(image);
    
   }
   
  } catch (MalformedURLException e) {
  }catch (IOException e) {
  }

  

//  2. 리소스 아이콘을 보여주는건 잘됩니다.~~
  imageView.setImageResource(mImageResourceIds[position]);
  imageView.setImageBitmap(bm);



  
  return imageView;
 }

}