ListView を含む子アクティビティがあります。このアクティビティは、SQLite カーソルから非同期的に設定されます。リスト項目には、TextView、RadioButton、および通常の Button が含まれています。XML を以下に示します。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/rlCategoryListItemLayout" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:id="@+id/tvCategoryListItemTitle" style="@style/uwLargeListItemLabelStyle" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:singleLine="true" android:text="This is a test note title" />
<LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true" android:gravity="center_vertical">
<RadioButton android:id="@+id/rdoCategoryListItemSelect" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginRight="10dip" />
<Button android:id="@+id/btnCategoryListItemDelete" android:background="@drawable/delete_red" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" />
</LinearLayout>
</RelativeLayout>
デフォルトでどの RadioButton が選択されているかを判断するには、いくつかのロジックを実行する必要がありますが、ListView が既に読み込まれるまでそれを行うことはできません。問題は、これまでに試したすべてのイベント (onCreate、onPostCreate、onResume、onWindowFocusChanged) で、ListView の子カウントがゼロであることです。また、ArrayAdapter クラスで getView メソッドを使用しようとしましたが、そのメソッドは複数回呼び出され、ListView の子カウントが毎回異なる可能性があり、予期しない結果につながります。どうやら、これらのイベントは、ListView がその子項目を完全に取り込み完了する前に発生しています。
リッスンできるイベント、または ListView の作成が完了し、そのすべての子がプログラムで変更できるようになったことを判断する他の方法はありますか?
ありがとうございました!