class BBaseAdapter extends BaseAdapter{
@Override
public int getCount() {
return addressList.size();
}
@Override
public Object getItem(int position) {
return addressList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
if(convertView == null){
convertView = getLayoutInflater().from(MainActivity.this).inflate(R.layout.myfriendlist, null);
holder = new Holder();
holder.userName = (TextView)convertView.findViewById(R.id.userName);
holder.userPhone = (TextView)convertView.findViewById(R.id.userPhone);
convertView.setTag(holder);
}else{
holder = (Holder)convertView.getTag();
}
holder.userName.setText(addressList.get(position).getUserName());
holder.userPhone.setText(addressList.get(position).getPhoneNum());
return convertView;
}
class Holder{
TextView userName,userPhone;
Button inviteButton;
}
}
BaseAdapter
最新推荐文章于 2022-05-11 11:18:11 发布