How can Check the condition of the two spinner?
Asked Answered
B

1

6

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:

https://i.sstatic.net/fjURS.png

Bazluke answered 9/10, 2014 at 15:20 Comment(5)
Show the code that you have so far and explain exactly where you are stuck.Mullin
you can get position of selected item and process second spinner depend on value :)Meter
Can i use Overlapping switch statement ? switch 1 cheked first spinner and inner switch cheked spinner 2Bazluke
You can concat the value of two spinner together and then compare that concatenated value using switch.Pinnacle
can you elaborate more??Margitmargo
M
2
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;
    }
}
Menjivar answered 28/10, 2015 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.