I am trying to read data that I inserted into firebase database, I want to display the data in custom listView. I am using this method but it seems that I am missing something.
I can't insert data into my arraylist.
UPDATED I inserted the values and now it gives me
attempt to invoke a virtual method on a null object reference on my get methods
private void showData(DataSnapshot dataSnapshot) {
for (DataSnapshot ds : dataSnapshot.getChildren()) {
PatientInformation patientInfo = new PatientInformation();
patientInfo.setName(ds.child(userID).getValue(PatientInformation.class).getName());
patientInfo.setAge(ds.child(userID).getValue(PatientInformation.class).getAge());
patientInfo.setDate(ds.child(userID).getValue(PatientInformation.class).getDate());
ArrayList<PatientInformation> arrayList = new ArrayList<>();
arrayList.add(patientInfo);
PatientInformationAdapter pAdapter = new PatientInformationAdapter(this, arrayList);
listView.setAdapter(pAdapter);
}
showData. We'll also want to see the JSON at the location you listen to, as text (no screenshots please). You can get this by clicking the "Export JSON" link in the overflow menu (⠇) on your Firebase Database console.