0
votes

I created my firebase console project and want to use real time database. I am able to add data using my model class (On Register Activity). But now i want to retrieve the same data in my HomeActivtiy.

Firebase is only providing valueChangeListener or addValueListener. But by the time i reach HomeActivity, and set the listener. Data has already changed and my Datasnapshot return null object on onDataChanged()

I am using Firebase version 3 - android

I want to do a get request to my "users" node, where I need data instead of just Database reference. is it possible in Firebase?

1

1 Answers

0
votes

Are you sure your reference is correct? If you are using an addValueEventListener on the HomeActivity then your value should also change in the HomeActivity (I assume you are getting a list of registrations).

Make your reference point to parent node of where the registrations are happening.

You can also prove yourself correct or wrong by adding an addOnSuccessListener after saving the registration data.

db.updateChildren(childUpdates).addOnSuccessListener(new OnSuccessListener<Void>() {
            @Override
            public void onSuccess(Void aVoid) {
                finish();
            }
        });