I am running into some trouble with my spinners. When every I select a value from them the spinner only takes the first value in the list.
For example I have a spinner with vales 1,2,3,4,5. When I select 4 the value taken from the spinner 1, this is the same if I select any of the other values.
Am I implementing the Spinner wrong? Or taking the values from the spinner wrong?
Spinner
<Spinner
android:id="@+id/heatSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/heat_title"
android:entries="@array/heat"/>
Array/Heat
<string-array name="heat">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
</string-array>
Taking Values from Spinner
Spinner heat = (Spinner) dialog.findViewById(R.id.heatSpinner);
final String heatValue = heat.getSelectedItem().toString();
final int finalHeat = Integer.parseInt(heatValue);
Aucun commentaire:
Enregistrer un commentaire