I have my spinner pulling from an array,(that works)..
What I want to happen is I have several textviews that will map to whatever is selected from the spinner array… e.g British Columbia. then the Texviews will all say british columbia.
I figure i should be using a setText of some kind but have been on able to find an example anyhelp would be appreciated.
Here is my spinner code:
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.material_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
final TextView tv34=(TextView) findViewById(R.id.tv34);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
tv34.setText(parent.getItemAtPosition(pos).toString());
}
public void onNothingSelected(AdapterView<?> parent) {
// Do nothing.
}
});
Try this:
EDIT :
Or you can do it like: