Multiple Spinners in one

Asked

Viewed 46 times

0

I have a Spinner A ,I would like if I clicked on an option of A,open an option on B,If I clicked on the second item of A ,open a difference in b,multiples inputtext on a single spinner

    catliv = (Spinner) findViewById(R.id.catergorialiv);


    List<String> list = new ArrayList<String>();
    list.add("Categoria");
    list.add("Informática");
    list.add("Didatico");
    list.add("Literatura");
    list.add("Infantil");

    ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, list);

    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    catliv.setAdapter(dataAdapter);

Spinner 2 :

    subcatlivro = (Spinner) findViewById(R.id.subcatergorialiv);
    subcatlivro.setVisibility(View.GONE);

    List<String> list6 = new ArrayList<String>();
    list6.add("Subcategoria");
    list6.add("Aplicativos");
    list6.add("Banco de dados");
    list6.add("Computação Gráfica");
    list6.add("Engenharia da Computação");
    list6.add("Gerenciamento de Projetos");
    list6.add("Hardware");
    list6.add("Inteligência Artificial");
    list6.add("Internet");
    list6.add("Jogos");
  • I didn’t understand a thing.

  • Cara wanted that when he selected "Informatics", appeared the subcategory that this there, if selected didactic,appeared another subcategory as Portuguese etc.. but all in the same Spinner.. I don’t know how to do this...

  • But do you think it will look good? Wouldn’t it be better to reload the second spinner only with the subcategories of the item selected in the first?

  • Anyway, to reload the spinner just change the data of the variable list6 and notify the spinner Adapter that the data changed, using a dataAdapter.notifyDataChanged();

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.