Spinner functions you can do

0

I want to use a Spinner but I need the option in the Spinner list that I tap to load another list of options in the same Activity .

Example of what I'm looking for:

Spinner 1______
               opción 1_____
                            Lista 1
               opción 2_____
                            Lsita 2
    
asked by Cristian Arce 26.12.2017 в 21:14
source

1 answer

1

What you need is to put a listener like for example

Spinner aux = (Spinner) findViewById(R.id.IDSPINNER);
final ArrayAdapter<String> dataAdapter7 = new ArrayAdapter<>(TuClase.this, R.layout.support_simple_spinner_dropdown_item, Datos);
        dataAdapter7.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        txtFechaMesExpedicion.setAdapter(dataAdapter7);
 aux.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
                Object tipo = dataAdapter7.getItem(position);
                if(tipo.toString.compareTo("Opcion1")==0){
                --Aca llamas al metodo que necesites
              }
            }

            @Override
            public void onNothingSelected(AdapterView<?> adapter) {
                // no se necesita
            }
        });

tell how it went

    
answered by 26.12.2017 в 21:32