I am having trouble updating the state of a Checkbox inside a SimpleCursorAdapter. I want to update the checkbox to reflect some data in my DB at the start of my ListActivity. My Layout is as follows:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <CheckBox android:id="@+id/IsChecked" android:layout_width="fill_parent" android:layout_height="wrap_content" android:focusable="false" android:clickable="false"/> <TextView android:id="@+id/stuff" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="italic"/> </LinearLayout> What I am trying to do is to set the state of the checkbox at the start but it does not work. I have tried putting it in: onStart(), onPause(), onContentChanged(), onJustAboutEverything() and it does not want to update. Just to make sure I wasn't crazy I put it in onListItemClick() and it worked when I clicked an item (everything else would update), but this is obviously not a solution. As a second experiment It tried it in onOptionsItemSelected which gets called when the menu is pressed but this mysteriously did not work. I am mystified by this problem and I need to figure it! Any ideas where I can put the update? Just for completeness, here is my update code: protected void UpdateCheckboxes() { ListView tempListView = this.getListView(); int nNumRows = tempListView.getCount(); //setup the check boxes to reflect the data for(int idx = 0; idx < nNumRows; idx++) { CheckBox cb = (CheckBox)((LinearLayout) tempListView.getChildAt(idx)).getChildAt(0); boolean bIsChecked = m_tasks.get(idx).isChecked; cb.setChecked(bIsChecked ); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---