I’ve got a spinner working where onItemSelected outputs a Toast. I want it to display a string value in a textview instead. So how would you rewrite the below method to show a string in a textview called denomiTV:
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
Toast.makeText(parent.getContext()), "Your Selection is: " +
parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
}
I tried this, but Eclipse says that .setText is not correct here:
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
denomiTV.setText(parent.getContext(), "Your selection is:" +
parent.getItemAtPosition(pos));
}
setText()takes a singleCharSequenceargument… you shouldn’t be passing in aContext.