dimanche 10 mai 2015

Spinner in Android doesn't show its selected item

It successfully manage to connect to the db, retrieve the data, and show them in the dropdown menu. But when i select an item in the spinner, it doesn't show in the "box".

   ArrayList<String> communities = new ArrayList<String> ();
  Spinner mySpinner = (Spinner) findViewById(R.id.lstCommunity);
    ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, communities); 

    mySpinner.setAdapter(adapter);
    popolaSpinner(communities,adapter);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

popolaSpinner is the function that takes the data from the DB

I also used

  protected void onPostExecute() {
 this.getArrayAdapterUsed().notifyDataSetChanged();
 }

Aucun commentaire:

Enregistrer un commentaire