I have a ListActivity with the ArrayAdapter whose text view resource
ID is android.R.layout.simple_list_item_checked. This displays a nice
list with checkmarks on each cell. I am able to get a reference to the
CheckedTextView on a click using:

protected void onListItemClick( ListView l, View v, int position, long
id)
  {
    CheckedTextView textView = (CheckedTextView) l.getChildAt
(position);
    textView.setChecked(!textView.isChecked());
    super.onListItemClick (l, v, position, id);
  }

What I am looking to do is go through the list of cells on the launch
of the activity and check them based on some data I have. I simply
can't figure out how to get ahold of a reference to the
CheckedTextView. I have tried:

     CheckedTextView associatedBuddyView = null;

     for (int currentBuddy = 0; currentBuddy < arrayAdapter.getCount
(); currentBuddy++)
     {
     associatedBuddyView = (CheckedTextView)this.getListView
().getChildAt (currentBuddy);
     associatedBuddyView.setChecked (true);
     }

But it did not work. Any help or guidance would be greatly
appreciated. Thank you!
-Brandon

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to