I have seen several answers related to this but could not figure out how to do this from one week. ARRAYLIST IS empty I tried using a query, using the function but couldn't get that any easy or better WORKING solution for this
mUserDatabase=FirebaseDatabase.getInstance().getReference().child(uid).child("Medicines");
mUserDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot childDataSnapshot : dataSnapshot.getChildren()) {
for (DataSnapshot childDataSnapshot2 : childDataSnapshot.getChildren()) {
//GET MEDICINE NAME
arrayList.add(childDataSnapshot2.getKey());
}}
@Override
public void onCancelled(DatabaseError databaseError) {}});