M
M
Max2017-05-11 11:44:22
Android
Max, 2017-05-11 11:44:22

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) {
        }

49838c2810944631860ca5e0bbfc270a.jpg
The database is only full for 2 days. When you click on May 10, it does not display data from the table
671016617487436b93aa5e60b3d6aed2.jpg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question