Android: two Spinner onItemSelected()
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
if(parent.getId() == R.id.spinner1)
{
//do this
}
else if(parent.getId() == R.id.spinner2)
{
//do this
}
}
public void onItemSelected(AdapterView<?> parent, View view,
int pos, long id) {
// An item was selected. You can retrieve the selected item using
//parent.getItemAtPosition(pos);
//Spinner spnir = (Spinner)parent;
parent.getItemAtPosition(pos);
TextView tvReadValue = (TextView) findViewById(R.id.tvReadValue);
switch (parent.getId())
{
case R.id.spinDimension:
tvReadValue.setText("spinDimension" + pos);
break;
case R.id.speedDimension:
tvReadValue.setText("speedDimension" + pos);
break;
}