안녕하세요!


  제가 커스텀뷰에서 사용할 어댑터를 만들고 있어요!


  class myAdapter extends BaseAdapter{

Context maincon;

LayoutInflater Inflater;

HashMap<String, String> roomInfo;

int layout;


public myAdapter(Context context, int alayout, HashMap<String, String> hash) {

maincon = context;

Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

roomInfo = hash; 

layout = alayout;

}


@Override

public int getCount() {

return roomInfo.size();  // 여기는 뭐.. 사이즈를 제대로 구해서 갯수만큼 출력하는 거 같구요..

}


@Override

public Object getItem(int position) {

return roomInfo.get(position); // 이 부분에서, hashmap 은 string 로 키값 검색하게 놔뒀는데 int 로 검색하려고 하는 것 같네요.. 어떡해야 하죠!?

}


@Override

public long getItemId(int position) { // 여기도 마찬가지. id 를 얻는거 같은데, string 로 하고 싶어요. override 는 지워봤자 소용없고..

return position;

}


@Override

public View getView(int position, View convertView, ViewGroup parent) {

if (null == convertView){

convertView = Inflater.inflate(layout, parent, false);

}

TextView sort = (TextView)convertView.findViewById(R.id.userComment);

System.out.println(roomInfo.get(position)); // 자. 드디어 에러가 발생하십니다.!!! 아오. 여기서 int 형 position 이 아닌 string position 으로 검색하고 싶습니다!!

return convertView;

}


  }


  그럼, 답변 기다리고 있을께요! @^ㅂ'@