0
So my code is this::
SpinnerDialog spinner;
String[] textoSeparado;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_item);
resultado = findViewById(R.id.result);
DocumentReference docRef = db.collection("Bebidas").document("Cervejas");
docRef.get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
public void onComplete(Task<DocumentSnapshot> task) {
String texto = task.getResult().getData().toString();
texto = texto.replaceAll("[^a-zZ-Z1-9 ]", "");
textoSeparado = texto.split("null");
}
});
resultado.setText(textoSeparado[0]);
}
But for some reason it says that the n array has data. if setText is placed inside onComplete works. I don’t know how to play the firestore, any ideas?