views:

9

answers:

0

Hi,

I am having problem, where i am not able to keep both disabled and enabled items in a list view with multiple choice mode set to it. I am using simple_list_item_multiple_choice.xml for listitem.

From what i could find on the Internet, i guess i have to override areAllItemsEnabled and isEnabled methods of ListAdapter.

However, after doing that, the items that i returned as disabled stay in the list looking like they can be clicked along with the dividers around them removed. ( They say they are the separators. )

This didn't solve my problem, so i took a different approach.

Now instead of the above mentioned methods, i override getView method and did the following things:

public View getView(int position, View convertView, ViewGroup parent) 
 {
  CheckedTextView view = (CheckedTextView)super.getView(position, convertView, parent);

  if(mEnableMap != null)
  {
   view.setEnabled(mEnableMap[position]);
  }

  return view;
 }

Although visually this solves my problem, but when i click on the disabled item, it somehow yet checks the CheckedTextView, showing that that item is selected. Even the getCheckedItemPositions method on the listview returns this item as checked.

What am i missing in all this? or is there other way? I want the implementation something like what we can see in Android device's settings ( particularly Wireless & network one, where if bluetooth is not supported, that item is greyed out and not selectable either).

Can anyone please help me on this?