Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
It is possible to upload List<Class> to firebase Realtime database

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!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

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!

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda