Here is a sample project demonstrating a checklist:

https://github.com/commonsguy/cw-android/tree/master/Selection/Checklist

To check items in the CHOICE_MODE_MULTIPLE, you do not call
setChecked() on the CheckedTextView. Call setItemChecked() on the
ListView.

On Thu, Sep 29, 2011 at 9:03 PM, Nathan <critter...@crittermap.com> wrote:
>
> What am I doing wrong?
> My adapter does this.
>    @Override public View getView(int paramInt, View paramView, ViewGroup
> paramViewGroup)
> {
>  CheckedTextView view;
>  if(paramView==null)
>  {
>  LayoutInflater vi =
> (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
>  view =
> (CheckedTextView)vi.inflate(android.R.layout.simple_list_item_multiple_choice,
> null);
>  }
> else
>  view=(CheckedTextView)paramView;
> view.setChecked(true);
>  view.setText(preflist.get(paramInt));
>  view.setTag(preflist.get(paramInt));
>  return view;
>  }
>
> I looked at the documentation for CheckedTextView.setChecked(boolean) and it
> says
> Changes the checked state of this text view.
>
> Well, it doesn't.
> In the debugger, I can see it get to the bold state.
> So is CheckedTextView useless for my purpose? I just want a multiselect
> list. I've even set it up like this:
>         setListAdapter(new MultiSelectAdapter(this));
>
>         final ListView listView = getListView();
>
>         listView.setItemsCanFocus(false);
>         listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
>         listView.setOnItemClickListener(this);
> Nathan
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to