null for argument 'pathString'

后端 未结 4 577
我寻月下人不归
我寻月下人不归 2021-01-20 10:25

I am having an error when I perform queries in firebase, my code for query looks like this:

@Override
protected void onCreate(Bundle savedInstanceState) {
           


        
4条回答
  •  青春惊慌失措
    2021-01-20 11:03

    To solve your problem, just declare nome, cpf and placa Strings inside the coresponding onDataChange() methods, otherwise is null, due the asynchronous behaviour.

    As an example, please use this code:

    public void onDataChange(DataSnapshot dataSnapshot) {
        String nome = dataSnapshot.getValue(String.class);
        TextView txtNome = (TextView) findViewById(R.id.txtNomePerfil);
        txtNome.setText(nome);
    }
    

    In the same way, you need to make the other changes.

提交回复
热议问题