I am using FirebaseListAdapter
for the ListView
and it is perfectly working fine. I have an additional requirement to display the count of elements present in the ListView
. How do I do that?
I read through the documentation of FirebaseListAdapter
and found that there is a method getCount()
which is supposed to return the count of elements. But it is always returning zero. Below is the code I have. What am I missing?
mAppointmentAdapter = new FirebaseListAdapter<Appointment>(options) {
@Override
public void populateView(View view, Appointment appointment, int position) {
TextView nameTextView = view.findViewById(R.id.app_patient_name_view);
TextView reasonTextView =
...
}
};
appointmentListView.setAdapter(mAppointmentAdapter);
// Display count of appointments
int mAppointmentsCount;
mAppointmentsCount = mAppointmentAdapter.getCount();
mAppointmentsCountView.setText(String.valueOf(mAppointmentsCount));
Need the count of elements in the ListView
or the adapter.