friends
I want to limit the choice of a flag in the list of androids, for example, you need to select only 3 flags, otherwise it should give an error message.
the user can select any three checkboxes from the list; someone will tell me how to achieve this? here is my adapter
public class AdapterContacts extends BaseAdapter { private LayoutInflater mInflater; public Context context; public static List<myContacts> contacts; public AdapterContacts(Context context,List<myContacts> list) { mInflater = LayoutInflater.from(context); this.context = context; contacts= list; } public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.list_contacts, null); holder = new ViewHolder(); holder.contactName = (TextView) convertView.findViewById(R.id.contactName); holder.contactNumber = (TextView) convertView.findViewById(R.id.contactNumber); holder.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } myContacts contact = getItem(position); holder.checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkboxView, boolean isChecked) { myContacts c = (myContacts) checkboxView.getTag(); c.setSelected(isChecked);
Any help would be appreciated.
source share