如何从Firebase检索微调器中的值。
d2.child("Course").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
final List<String> Course = new ArrayList<String>();
for (DataSnapshot areaSnapshot: dataSnapshot.getChildren()) {
String CName = areaSnapshot.child("name").getValue(String.class);
Course.add(CName);
}
spinner = (MaterialSpinner) findViewById(R.id.reg_Course);
ArrayAdapter<String> areasAdapter = new ArrayAdapter<String>(RegisterActivity.this, android.R.layout.simple_spinner_item, Course);
areasAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(areasAdapter);
}
这是代码的样子,但微调框中没有任何显示