Answer the question
In order to leave comments, you need to log in
How to update a firebase list?
Good day to all. Need help. When I switch the date, I want the list (of clients from Firebase) to change, through the method I display the date for the current moment, everything works fine, but when I click on another day, the list is not updated. Can you please tell me how to update the list?
Calendar c = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd_MM_yyyy");
Date date = new Date();
calendarView = (CalendarView) findViewById(R.id.calendarView);
selectedDate = sdf.format(date);
try {
calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
@Override
public void onSelectedDayChange(@NonNull CalendarView calendarView, int year, int month, int dayOfMonth) {
int mYear = year;
int mMonth = month;
int mDay = dayOfMonth;
selectedDate = new StringBuilder().append(mDay).append("_").append(mMonth + 1).append("_")
.append(mYear).toString();
Toast.makeText(MainActivity.this, selectedDate, Toast.LENGTH_SHORT).show();
result.clear();
reference = database.getReference(selectedDate);
}
});
} catch (NullPointerException e) {
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question