I can not return data from the firebase user to display in edittext, how do I?

0

The code I'm using is this:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cotacao);

        mTextView = (TextView) findViewById(R.id.textFarm);

        FirebaseDatabase mDatabase = FirebaseDatabase.getInstance();
        mDataBaseRef = ConfiguracaoFirebase.getFirebase().child("usuario").child("nome");

        mDataBaseRef.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                String s = dataSnapshot.getValue(String.class);

                Toast.makeText(CotacaoActivity.this, "O que aparece! " + s, Toast.LENGTH_SHORT).show();

                setTextView(s);
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                setTextView(databaseError.toString());
            }
        });

I need to insert this name into a TextView. Only returns null. I've tried the most diverse examples and answers from you. Someone can help.

    
asked by anonymous 16.08.2018 / 20:55

0 answers