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
Asked
Active
Viewed 204 times
0

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
3Please 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 Answers
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