How to manipulate data in list view that is populated by custom cursor adapter Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to manipulate data in list view that is populated by custom cursor adapter without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have populated a list view using the custom cursor adapter, That listview consists of a checkbox and button in the below manner.

checkbox1 button1
checkbox2 button2
.
.
.

Now I want to navigate to another activity when click on the button in list view now my issue here is when I click on the button1 then I want to see the data in checkbox1 and similarly for other rows as well.

Now I am confused on how to maintain a sync between the checkbox and button and how to achieve the click functionality. How can I achieve this?

Answer

You can do the following on the Button‘s onClickListener if the Button and CheckBox share the same parent

boldButton.setOnClickListener(new OnClickListener()
{

    @Override
    public void onClick(View view)
    {
       View parentView = (View) view.getParent();
       CheckBox checkBox = (CheckBox) parentView.findViewById(R.id.check);
    }
});

This will give you the CheckBox corresponding to the clicked Button

We are here to answer your question about How to manipulate data in list view that is populated by custom cursor adapter - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji