Firebase shows data on one Activity and the other not

Asked

Viewed 174 times

1

I am using firebase. To take a test and how to use it I did the whole procedure in a test Activity of my app. I saw that it worked, so I want to put it to the correct Activity. The codes of both are correct, but when executed in the client Activity nothing appears.

Follows the codes:

Test activity:

public class ActivityTeste extends AppCompatActivity {

Firebase objetoRef;
ListView minhaLista;

ArrayList<String> minhaListaDeTarefas = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_teste);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar); //Setar o botão voltar
    getSupportActionBar().setHomeButtonEnabled(true); //Setar o botão voltar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true); //Setar o botão voltar

    Firebase.setAndroidContext(this);

    minhaLista = (ListView) findViewById(R.id.listViewteste1);
    objetoRef = new Firebase("https://XXXXXX.firebaseio.com/");
    Firebase novaRef = objetoRef.child("Pessoa");

    final FirebaseListAdapter<String> adapter = new FirebaseListAdapter<String>(this, String.class, android.R.layout.simple_list_item_1, novaRef) {
        @Override
        protected void populateView(View view, String s, int i) {

            TextView textView = (TextView) view.findViewById(android.R.id.text1);
            textView.setText(s);

        }
    };

      minhaLista.setAdapter(adapter);

}

}

This same code I’m using on the right Activity. And this one doesn’t show the data:

Mostra o conteúdo Firebase

Não mostra o conteúdo Firebase

  • Where’s the Actvitiy client code?

  • @seamusd as I said above, they both have the same code. It makes no sense for me to put the same code twice.

  • Rename what you say man ?

  • But there’s no feeling right man. This will in the end give the same as I did so far. Take the code of the test Activity and put in the correct Activity.

  • Are you making a mistake or just don’t show up!?

  • That’s the weird thing. It compiles and makes no mistake. It just doesn’t show up at all,

Show 1 more comment

1 answer

1


Guys, I got it done yesterday. What was happening is a bug. After uninstalling the app and running it again it accessed correctly. Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.