MainActivity.java
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.Door_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
Button button = (Button)findViewById(R.id.Button1);
button.setText(spinner.getSelectedItem().toString());
}
}
2
Answers
Changing the text of button every time you must enter your code inside of this functions :
try this