T
T
TaTIk942016-10-17 13:53:38
Java
TaTIk94, 2016-10-17 13:53:38

Can't get data from Firebase DB?

A simple example has already stumbled, I can’t get the data from the database

private DatabaseReference mDatabase;


    TextView textView;
...

 mDatabase = FirebaseDatabase.getInstance().getReference();

        textView = (TextView) findViewById(R.id.textView);

        ValueEventListener postListener = new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                // Get Post object and use the values to update the UI
                String value = dataSnapshot.getValue(String.class);
                textView.setText(value);
                // ...
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                // Getting Post failed, log a message

                // ...
            }
        };
        mDatabase.addValueEventListener(postListener);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikalay Gromihaylo, 2016-10-28
@theendcomplete

what version of android? the rights to the Internet application were given, if above 5?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question