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:
Where’s the Actvitiy client code?
– viana
@seamusd as I said above, they both have the same code. It makes no sense for me to put the same code twice.
– Artur Mafezzoli Júnior
Rename what you say man ?
– Artur Mafezzoli Júnior
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.
– Artur Mafezzoli Júnior
Are you making a mistake or just don’t show up!?
– viana
That’s the weird thing. It compiles and makes no mistake. It just doesn’t show up at all,
– Artur Mafezzoli Júnior