0

I have a listview whose rows has one textview and a check box.

I want to pop the name associated with the checkbox and on a click of a button i want to store all the textview data in to database. How would I do this?

3
  • I wouldn't suggest this if it wasn't crucial: Check your spelling before posting. Commented May 17, 2012 at 10:12
  • check this question: it sure help you. stackoverflow.com/questions/10481066/… Commented May 17, 2012 at 14:25
  • Keyser: thanks.. ill remember that... Commented May 18, 2012 at 10:01

1 Answer 1

1

Try something like this:

if (checkBox.isChecked()) {
    View view = listview.getChildAt(position);
    TextView text = (TextView)view.findViewById(R.id.myTextBox);
    String contents = text.getText().toString();
}

You will need to tweak the if statement to your own checkboxes and iterate through them to check are they checked and rename the code in the if statement to your oen names

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

1 Comment

but how to do it for every checked item in listview is single click

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.