I have a Simple class named Questions which contain :
public class Questions {
String question,correctAns;
String[] incorretAns;
public Questions() {
}
public Questions(String question, String correctAns, String[] incorretAns) {
this.question = question;
this.correctAns = correctAns;
this.incorretAns = incorretAns;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getCorrectAns() {
return correctAns;
}
public void setCorrectAns(String correctAns) {
this.correctAns = correctAns;
}
public String[] getIncorretAns() {
return incorretAns;
}
public void setIncorretAns(String[] incorretAns) {
this.incorretAns = incorretAns;
}
}
and I want to upload it as a List<Questions> questionsList list to firebase real-time database it is possible to upload!.
I have tried to upload it but the firebase real-time database gives an exception: something like this:
FirebaseDatabase.getInstance().getReference().child("Questions")
.child("randomID")
.setValue(questionsList);
And it gives Exception like this:
com.google.firebase.database.DatabaseException: Serializing Arrays is not supported, please
use Lists instead
And there is any other way to upload this type of data any help will be appreciated!
You have used String[] incorretAns; that's why you are getting this expectation:
com.google.firebase.database.DatabaseException: Serializing Arrays is not
supported, please
use Lists instead
So instead of String[] incorretAns you can use options individually like:
String OptionA, OptionB, OptionC //or whatever you like
then you will not receive any errors I hope it helps you!