Back to project page whoisit-android.
The source code is released under:
MIT License
If you think the Android project whoisit-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.mitchbarry.android.whoisit.ui; /*from www. j ava2 s .c o m*/ import android.text.TextUtils; import android.view.LayoutInflater; import com.mitchbarry.android.whoisit.R; import com.mitchbarry.android.whoisit.core.PhoneGroup; import com.github.kevinsawicki.wishlist.SingleTypeAdapter; import java.util.List; /** * Adapter to display a list of phone groups */ public class PhoneGroupListAdapter extends SingleTypeAdapter<PhoneGroup> { /** * @param inflater * @param items */ public PhoneGroupListAdapter(LayoutInflater inflater, List<PhoneGroup> items) { super(inflater, R.layout.phone_group_list_item); setItems(items); } /** * @param inflater */ public PhoneGroupListAdapter(LayoutInflater inflater) { this(inflater, null); } @Override public long getItemId(final int position) { final String id = getItem(position).getName(); return !TextUtils.isEmpty(id) ? id.hashCode() : super .getItemId(position); } @Override protected int[] getChildViewIds() { return new int[] { R.id.tv_name }; } @Override protected void update(int position, PhoneGroup phoneGroup) { setText(0, phoneGroup.getName()); } }