안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요. listview checkbox 에 관한 질문과 답변들이 많이 있지만 아직 잘모르는 부분이 많아서
이렇게 질문올립니다.ㅠ.ㅠ
private class CallListItemAdapter1 extends ArrayAdapter<CallScreenItem1> {
CallScreenItem1 item;
private ArrayList<CallScreenItem1> items;
public CallListItemAdapter1(Context context, int textViewResourceId, ArrayList<CallScreenItem1> items) {
super(context, textViewResourceId, items);
this.items = items;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
id = position;
Log.i("bbbbbbb","bbbbbbbb= " +id);
if (v == null) {
LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row, null);
}
CallScreenItem1 p = items.get(position);
if (p != null) {
TextView t_name = (TextView) v.findViewById(R.id.addcontact_Name);
TextView t_number = (TextView) v.findViewById(R.id.addcontact_Number);
ImageView t_photo = (ImageView) v.findViewById(R.id.addcontact_photo);
CheckBox t_checkbox = (CheckBox) v.findViewById(R.id.check);
//여기서 먼가 리스너를 주면 되지 않을까 라고 생각을 해봤는데요.. 여기서 진도가 잘 안나가서요.ㅠ.ㅠ
t_checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if ( isChecked )
Log.i("test", "test ");
}
});
if ( t_name != null){
t_name.setText(p.getName());
}
if(t_photo != null){
t_photo.setImageBitmap(p.getPhoto());
}
if ( t_number != null){
t_number.setText(p.getNumber());
}
}
return v;
}
}
체크박스에서 체크된 listview 들의 position 값들이나 그 listview 의 정보를 알 수 있는 방법이 없을까요?.그림 첨부합니다~~
listview.bmp



