Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AdapterContacts extends BaseAdapter implements OnClickListener {
- ToggleButton btnIsSending;
- .
- .
- .
- public View getView(int position, View convertView, ViewGroup viewGroup) {
- Contact entry = contactsList.get(position);
- if (convertView == null) {
- LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- convertView = inflater.inflate(R.layout.contact_row, null);
- }
- .
- .
- .
- // isSending button
- btnIsSending = (ToggleButton) convertView.findViewById(R.id.btnIsSending);
- btnIsSending.setFocusableInTouchMode(false);
- btnIsSending.setFocusable(false);
- btnIsSending.setOnClickListener(this);
- btnIsSending.setTag(entry);
- return convertView;
- }
- public void onClick(View view) {
- final Contact entry = (Contact) view.getTag();
- Log.d(TAG, "entry " + entry.getPhoneNr());
- LookalizeData lookData = (LookalizeApp.getContext()).lookalizeData;
- // Toggle send button
- if( view.getId() == btnIsSending.getId()){
- if(btnIsSending.isChecked())
- ...
- else
- ...
- }
- ListView lv = ((ListActivity)context).getListView();
- // Containing all check states
- SparseBooleanArray sba = lv.getCheckedItemPositions();
- btnIsSending = (ToggleButton) convertView.findViewById(R.id.btnIsSending);
- btnIsSending.setFocusableInTouchMode(false);
- btnIsSending.setFocusable(false);
- btnIsSending.setTag(entry);
- btnIsSending.setChecked(false);
- // Cursor is passed as an argument.
- if(sba != null)
- if(sba.get(cursor.getPosition()))
- btnIsSending.setChecked(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement