Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Check the condition of the two spinner?

How can Check the condition of the two spinner?

I have two spinners in my project. I want to write unit conversion project How can the different conditions of the selected spinners item Understand ?

Similar to the image below:

http://i.stack.imgur.com/fjURS.png

like image 234
Developer Avatar asked Oct 09 '14 15:10

Developer


1 Answers

firstSpinner.setOnItemSelectedListener(this);
secondSpinner.setOnItemSelectedListener(this);

@Override
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
    Spinner spinner = (Spinner) parent;

    switch (spinner.getId()) {
    case R.id.first_spinner:
        // item selected on the first spinner
        // use position
        break;
    case R.id.second_spinner:
        // item selected on the second spinner
        // use position
        break;

    default:
        break;
    }
}
like image 200
netpork Avatar answered Oct 30 '22 00:10

netpork