I have taken 3 edittext in my form and three spinner. I can easily get the data from edit text and display it on Textview, but the problem is how to get the data from spinner and display all the edit text and spinnner values in textview. I am creating a form in which when the button is clicked all the data from edittext text and spinner is displayed on Textview
Asked
Active
Viewed 5,368 times
3 Answers
0
please try this one:
String textValue= yourSpinner.getSelectedItem().toString();

Zoe
- 27,060
- 21
- 118
- 148

Mitul Gedeeya
- 886
- 1
- 10
- 20
0
Try this
Button btn = (Button) findViewById(R.id.your_btn);
btn.setOnClickListner(new OnClickListener {
public void onClick(View v)
{
String spinnerStr = yourSpinner.getSelectedItem().toString();
String editTextStr = yourEditText.getText().toString();
yourTextView.setText(spinnerStr + editTextStr);
}
}
);

Unmitigated
- 76,500
- 11
- 62
- 80

Cyph3rCod3r
- 1,978
- 23
- 33
0
Try this:
Spinner spinner = (Spinner) findViewById(R.id.spinner);
TextView textView = (TextView) findViewById(R.id.textView);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v){
String item= spinner .getSelectedItem().toString();
textView .setText(item);
}
});

Sonali8890
- 2,005
- 12
- 16