Thursday, September 29, 2011

[android-developers] CheckedTextView won't check.


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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment