0

this is the code i am using but the data cannot be accessed out the datasnapshot and the data is been successfully retrieved which i can view in my logcat ,but it just does not get added in Arraylist ##```try {

        mbase = FirebaseDatabase.getInstance().getReference("/information/" + y2+"/"+c2+"/"+s2+"/");
        mbase.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot snapshot) {
                for (DataSnapshot ds : snapshot.getChildren()) {
                    String key = ds.getKey();
                    mySubject.add(key);
                    //Log.i("SubjectNo", key);
                }
            }
            @Override
            public void onCancelled(@NonNull DatabaseError error) {
            }
        });
    }catch (Exception e){
        e.printStackTrace();```

0 Answers0