Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/01/2014, 14:35
Avatar de BlinDer
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!!!!