Hi everyone,
I'm just started with android developing but I'm facing a problem.
I made a good working spinner but how do i use it? I want that when i select for example "AP_KEU1-1" that in a text box "AP_KEU1-1" appears.
The writing down of the text is easy i do that with this code but how do i get the variable that is selected
The spinner java code
The XML file called array.xml
I'm just started with android developing but I'm facing a problem.
I made a good working spinner but how do i use it? I want that when i select for example "AP_KEU1-1" that in a text box "AP_KEU1-1" appears.
The writing down of the text is easy i do that with this code but how do i get the variable that is selected
Code:
TextView weeknr = (TextView) findViewById(R.id.week);
weeknr.setText("the selected one");
Code:
Spinner kiesklas = (Spinner) findViewById(R.id.lijstklas);
ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.klassen, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
kiesklas.setAdapter(adapter);
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="klassen">
<item>-</item>
<item>AP_KEU1-1</item>
<item>AP_KEU1-2</item>
<item>AP_KEU1-3</item>
<item>AP_KEU1-4</item>
<item>AP_KEU1-5</item>
.....
</string-array>
</resources>