I have a listview which is populated from a webservice using an ArrayAdapter. The webservice provides me with all the data I need. Some are just plain textviews yet other alternate between EditText and spinners. I show them easily, also filling up the values where they're due in EditText fields.
The problem comes with filling up the value of the Spinner. Can I define an adapter within an adapter? Also my data comes from a webservice as an XML passed as a string.
My Spinner code so far inside my Adapter.cs:
if (item.FieldType == "OptionBOX")
{
Spinner SpinnerValue = (Spinner) view.FindViewById<Spinner>(Resource.Id.spinnerVal);
SpinnerValue.Visibility = view.Visibility == ViewStates.Invisible ? ViewStates.Invisible : ViewStates.Visible;
bool isReadOnly = bool.Parse(item.isReadOnly);
if (isReadOnly == true)
{
SpinnerValue.Enabled = false;
SpinnerValue.Focusable = false;
SpinnerValue.FocusableInTouchMode = false;
}
}
My data for the spinner is within item.optbox_options.
A table from my XML for easier understanding:
<Table diffgr:id="Table5" msdata:rowOrder="4">
<IdRec>5</IdRec>
<FieldId>1026</FieldId>
<FieldDesc>stanje rezervoarja</FieldDesc>
<FieldType>ComboBOX</FieldType>
<isReadOnly>true</isReadOnly>
<FieldValue>6</FieldValue>
<FieldTextValue>2/4</FieldTextValue>
<OptBox_Options>
<Options><myOPT FieldValue="1" FieldTextValue="0"/><myOPT FieldValue="2" FieldTextValue="1/4"/><myOPT FieldValue="6" FieldTextValue="2/4"/><myOPT FieldValue="7" FieldTextValue="3/4"/><myOPT FieldValue="8" FieldTextValue="4/4"/></Options>
</OptBox_Options>
</Table>
So just to clarify my needs and wants: Can I use an adapter within an adapter and if I can - how? How can I display data from the OptBox_Options row? I need to display the value from the FieldTextValue column inside in my spinners.