Android : JSONArray, not all data are

on Sunday, September 21, 2014


See if I can help. android have this code:



String data;
data=httpGetData("http://192.168.1.15/CodigoPHP/prueba/consultarUsuario.php");
if(data.length()>1)
ja=new JSONArray(data);
Toast.makeText(getApplicationContext(), "esto da:"+data,Toast.LENGTH_LONG).show();

} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Error recuperando la informacion del servidor, verifique su conexion a internet y vuelva a intentarlo.",Toast.LENGTH_LONG).show();

}
try{

for(int i=1; i<ja.length();i++) {
british.add(ja.getString(i));
}

//texto.setText(ja.getString(1));
Toast.makeText(getApplicationContext(), "esto da:"+ja.length(),Toast.LENGTH_LONG).show();


The problem is as follows: Suppose there are two in my base discharged clients, and each client has eight fields. As many fields are filled 16. By displaying the string "data" shows me data from two clients. But in the JSONArray "ja" there is only one client. Show size in toast and gives me 8 Also put my JSONArray in arrayList and the same, just a client. And I do not understand that, and I should get it all to do "ja = new JSONArray (data);" There any explanation?


0 comments:

Post a Comment