アクティビティのレイアウトにListViewがあります。listview_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/MyListView" />
</LinearLayout>
ListViewのListItemに別のレイアウトを使用しています。
listitem_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent">
<TextView
android:id="@+id/txtTitle"
android:layout_width="80dp"
android:layout_height="wrap_content" />
<Spinner
android:id="@+id/MySpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
私のアクティビティのレイアウトは、listview_layout.xmlのレイアウトと同じです。
私はSimpleAdapterを使用してlistitem_layout.xmlのレイアウトを引用しました。
問題:ここで、listview_layout.xmのスピナーコントロールIDを取得したいと思います。
ListViewのアクティビティでfindViewById(MySpinner)を使用していますが、nullポインター例外のエラーがあります。見つけることができません。アクティビティレイアウトファイルは、listview_layout.xmlのlistview_layout.xmlとSpinnerコントロールを使用するためです。
誰かの助けはとてもありがたいです。