I stored a number in a field of a document and want to retrieve it but I get the following error:
String resource ID #0x1
I am using this method to retrieve the number. Is the number stored in Firestore as Long, Integer or Double? I didn't find any answer to that, and how can I resolve this error so I can retrieve the number and use it in my code?
The error is displayed in the Toast
line.
Your help is very much appreciated!
Here is my code:
Integer round;
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private CollectionReference roundRef = db.collection("Games");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_interim_result);
...
roundRef.document(gameId).collection("Round").document("Round").get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.isSuccessful()){
DocumentSnapshot document = task.getResult();
if (document != null){
round = document.getLong("round").intValue();
Toast.makeText(PlayInterimResultMainActivity.this, round, Toast.LENGTH_SHORT).show();
}
}
}
});
...