0
I’m trying this, but it always appears that the app has stopped working.
public class TesteActivity extends AppCompatActivity {
private TextView la;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.teste);
la = (TextView) findViewById(R.id.txtavisoteste);
DatabaseReference dref = FirebaseDatabase.getInstance().getReference().child("usuario");
dref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String value = dataSnapshot.getValue(String.class);
la.setText(value);
}
@Override
public void onCancelled(DatabaseError error) {
Toast.makeText(TesteActivity.this, "Erro: " + error.toException(), Toast.LENGTH_SHORT).show();
}
});
}
}