I'm trying to get data from a SimpleAdapter, but I don't know the syntax for it. Example code:
month_selector.xml
<LinearLayout android:orientation="vertical">
<TextView
android:id="@+id/text"
android:text="Month of birth"
/>
<Spinner
android:id="@+id/spin_birthmonth"
android:entries="@array/birthmonth"
/>
</LinearLayout>
Activity page
public class SomeActivity extends Activity {
SimpleAdapter adapter;
ListView lv;
protected List<HashMap<String, String>> fillMaps;
protected String[] from;
protected int[] to;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lv = (ListView) findViewById(R.id.room_list_view);
fillMaps = new ArrayList<HashMap<String, String>>();
from = new String[] {"title", "spinner"};
to = new int[] {R.id.text, R.id.spin_birthmonth};
HashMap<String, String> map = new HashMap<String, String>();
map.put("title", "Your month of birth");
fillMaps.add(map);
adapter = new rSimpleAdapter(this, fillMaps, R.layout.month_selector, from, to);
lv.setAdapter(adapter);
}
}
I've cut out some stuff to make it legible, so let me know if I'm missing anything. What I want to do is something along the lines of...
Spinner month = adapter.getSpinner(R.id.spin_month);
But I have no idea what the syntax is to get the spinner from within the adapter. I'm fine with making it a custom adapter if that would solve the problem.