Skip to content Skip to sidebar Skip to footer

Firebase Data To Spinner

Data trying to access Firebase Database Screenshot I'm trying to store all the values to a spinner but it seems like using arraylist and many other functions aren't even helping mu

Solution 1:

You can create a method to set the data in the spinner in the following way:

public void showDataInSpinner(ArrayList<String> data) {
          ArrayAdapter<String> adapter = new ArrayAdapter<>(
                    this, android.R.layout.simple_spinner_item, data
            ); //Create the Adapter to set the data
            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //Set the layout resource to create the drop down views.
            youSpinner.setAdapter(adapter); //Set the data to your spinner
    }

Post a Comment for "Firebase Data To Spinner"