0

In my application I am using Custom Listview with row as TextView and CheckBox.
Now I want that when I check CheckBox at that time that respective row have to Disable(unfocasable).
What should be the code inside CheckBox OnCheckedChangeListener
I also tried to disable rowlayout inside Listener but not got success...
following is code I am using inside getView method of Adapter

final RelativeLayout RL=(RelativeLayout)convertView.findViewById(R.id.VTRLmain);
        check.setOnCheckedChangeListener(new OnCheckedChangeListener() 
        {
            @Override
            public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) 
            {
                if (isChecked) 
                {   
                    RL.setEnabled(false);
                     templist.add(getItem(position));//using for another activity
                }
            }
        });
3
  • put your all code mean holder here Commented Mar 1, 2013 at 13:05
  • simple if else can work out here. just do nothing if the check box is checked. but this will not disable row focusable Commented Mar 1, 2013 at 13:08
  • i am using another list for checked Items.. So doing nothing not feasible Commented Mar 1, 2013 at 13:54

2 Answers 2

2

give in xml code for checkbox

android:focusable="false"

it won't hide listview textboxs.

and check the application theme.

Sign up to request clarification or add additional context in comments.

1 Comment

xml code not matters here. there should be code inside adapter class
0

In the adapter there is a method named isEnabled which you can overide. Try to do in your custom adapter

Try this code:

@Override
public boolean isEnabled(int position) {
if(checkbox1.isChecked()){
    return false;
}
return true;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.