*/public class ProfessionalListAdaptor extends BaseAdapter { List<ProfessionalResultModel> prList; Context mContext; ViewHolderItem viewHolder; public ProfessionalListAdaptor(Context context, List<ProfessionalResultModel> aList) { this.prList = aList; this.mContext = context; } @Overridepublic int getCount() { return prList.size(); } @Overridepublic Object getItem(int position) { return prList.get(position); } @Overridepublic long getItemId(int position) { return position; } @Overridepublic View getView(final int position, View convertView, ViewGroup parent){ if (convertView == null) { viewHolder = new ViewHolderItem(); LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.professional_profile_list_item, null); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolderItem) convertView.getTag(); } viewHolder.txtName = (TextView) convertView .findViewById(R.id.txtName); viewHolder.txtName.setText(list.getFirst_name() + " " + list.getLast_name()); return convertView; }static class ViewHolderItem { TextView txtName; }}
Wednesday, 18 May 2016
BaseAdaptor Example Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment