0

I have a list view with check boxes.I want to get all the checked items ids or data in the particular position.

Please any one help me with sample code

Thanks in advance

2
  • Can you add the xml for the row layouts and maybe a screenshot to better understand what you are looking for? Commented Nov 7, 2011 at 22:30
  • Thanks for your response Bobbake4 .I added my answer to this question below Commented Nov 8, 2011 at 17:46

1 Answer 1

1

I found this answer from Internet

Working properly what i need

my_sel_items=new String("Selected Items");

            SparseBooleanArray a = lView.getCheckedItemPositions();

            for(int i = 0; i < lv_items.length ; i++)


            {
                if (a.valueAt(i))
                {
                 /*
                    Long val = lView.getAdapter().getItemId(a.keyAt(i));
                    Log.v("MyData", "index=" + val.toString()
                         + "item value="+lView.getAdapter().getItem(i));
                    list.add(lView.getAdapter().getItemId((a.keyAt(i))));
                 */
                    my_sel_items = my_sel_items + "," 


                        + (String) lView.getAdapter().getItem(i);

                }
            }
            Log.v("values",my_sel_items);
Sign up to request clarification or add additional context in comments.

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.