private class callsmsAdapter extends BaseAdapter {
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public int getCount() {
return list.size();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
ViewHolder holder;
if (convertView == null) {
view = View.inflate(getApplicationContext(), R.layout.item_call_sms_safe, null);
holder = new ViewHolder();
holder.tv_number = (TextView) view.findViewById(R.id.tv_black_number);
holder.tv_mode = (TextView) view.findViewById(R.id.tv_black_mode);
view.setTag(holder);
} else {
view = convertView;
holder= (ViewHolder) view.getTag();
}
BlackNumberInfo info = list.get(position);
holder.tv_number.setText(info.getNumber());
switch (info.getMode() + "") {
case 1 + "":
holder.tv_mode.setText("电话拦截");
break;
case 2 + "":
holder.tv_mode.setText("短信拦截");
break;
default:
holder.tv_mode.setText("全部拦截");
break;
}
return view;
}
}
static class ViewHolder {
TextView tv_number;
TextView tv_mode;
}