Call a method using Spinner selection

3

Is it possible to call a method using Spinner of android?

I need to select the option and based on this selected option I need to send request to webservice , and this will return me the other options of Spnnier .

    
asked by anonymous 12.12.2016 / 16:21

1 answer

2

Through setOnItemSelectedListener :

spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
        // SEU CÓDIGO 
    }

    @Override
    public void onNothingSelected(AdapterView<?> parentView) {
         // SEU CÓDIGO 
    }

});

Follow the documentation

    
12.12.2016 / 16:26