Foros del Web » Programando para Internet » Android »

Recorrido de GSON

Estas en el tema de Recorrido de GSON en el foro de Android en Foros del Web. hola alguien podria ayudarme con el recorrido de GSON, ya que necesito que este lo haga adecuadamente, lo cual antes salia pero pues ahora se ...
  #1 (permalink)  
Antiguo 31/01/2014, 14:35
Avatar de BlinDer  
Fecha de Ingreso: julio-2013
Mensajes: 52
Antigüedad: 10 años, 9 meses
Puntos: 0
Recorrido de GSON

hola alguien podria ayudarme con el recorrido de GSON, ya que necesito que este lo haga adecuadamente, lo cual antes salia pero pues ahora se salta muestra!!!!

Codigo GSON

{
"Cuestionario": [
{
"Preguntas": [
{
"Pregunta1": [
{
"tipo": "TextView",
"id": 1,
"txtquest": "¿Que vamos hacer hoy?"
}
],
"Pregunta2": [
{
"tipo": "EditText",
"id": 2,
"txtquest": "¿EditText?",
"prueba": "solo es prueba"
}
],
"Pregunta3": [
{
"tipo": "CheckBox",
"id": 3,
"txtquest": "¿ESTO ES UN CHECKBOX? +++1"
}
],
"Pregunta4": [
{
"tipo": "Spinner",
"id": 4,
"lista": "Selecciona una opcion,Ultimate Game,Need for Speed,Ulimate Racing,Rockstar Games,Thunder Bolt"
}
],
"Pregunta5": [
{
"tipo": "RadioGroup",
"id": 5,
"txtquest": "¿Que RadioGroup? ",
"radios": 2
}
],
"Pregunta6": [
{
"tipo": "EditText",
"id": 6,
"txtquest": "¿ES SOLO UNA PRUEBA MAS DE EditText?",
"prueba": "solo es prueba"
}
],"Pregunta7": [
{
"tipo": "TextView",
"id": 7,
"txtquest": "¿ES SOLO OTRO TEXTVIEW?"
}
]
}
]
}
]
}

Codigo Java
Código Java:
Ver original
  1. JSONArray obj2 = datos.getJSONObject(i).getJSONArray(key1);
  2.                     int r = obj2.length();
  3.                     //                  System.out.println("var r.............. "+ r);
  4.                     for(int a = 0; a < r; a++) {
  5.                         Iterator<?> itera = obj2.getJSONObject(a).keys();
  6.                         while(itera.hasNext()){
  7.                             String key2 = (String) itera.next();
  8.                                                     System.out.println("esta es mi llave key2 ----- "+key2);
  9.                             //                      System.out.println("--------------{\""+key2 + "\" : " + obj2.getJSONObject(a).get(key2)+"}");
  10.  
  11.                             JSONArray obj3 = obj2.getJSONObject(a).getJSONArray(key2);
  12.                             //                          int j = obj3.length();
  13.                             //                      System.out.println("imprimiendo la variable J....." + j);
  14.                             //                      System.out.println("variable a....... "+ a);

Antes lo recorria bien, pero ahora recorre la pregunta 1, se va a la 7 luego 6, 5, 4, 3, 2, 1 alguien podria ayudarme con este problema se los agradeceria, gracias!!!!
  #2 (permalink)  
Antiguo 04/02/2014, 11:08
Avatar de BlinDer  
Fecha de Ingreso: julio-2013
Mensajes: 52
Antigüedad: 10 años, 9 meses
Puntos: 0
Respuesta: Recorrido de GSON

Aguien quien me pueda ayudar con este JSON como hacer que recorra 1,2,3,4,5,6, etc......

Etiquetas: checkbox, java, recorrido, view
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:35.