0

enter image description here

i am retrieving value from the firebase in string and then i want to set that value as a default spinner value ? i am not accessing the value after onDatatChange() method

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 3
    Please don't post screenshots of your code, or other textual content. Instead post the actual text, and use the formatting tools of Stack Overflow to mark it up. In general, I'd recommend reading [how to create a minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) and following all guidance in there. – Frank van Puffelen Oct 19 '20 at 18:13

1 Answers1

0

You can add an adapter to the Spinner with the corresponding values, like:

    Spinner spin = (Spinner) findViewById(R.id.spinner);  
      
    //Creating the ArrayAdapter instance having the list  
    ArrayAdapter adapter = new ArrayAdapter(context, android.R.layout.simple_spinner_item, <list of values>);  
    aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);  

    //Setting the ArrayAdapter data on the Spinner  
    spin.setAdapter(aa);  
Hamza Israr
  • 411
  • 2
  • 7