Estoy rescatando dos colunmas con informacion(latitud y longitud) de una base de datos.El problema que tengo es que no puedo mostrar las columnas:latitud en un texview y la longitud en otro. este es mi codigo:
@Override
public void onResponse(String response) {
try {
JSONArray a = new JSONArray(response);
String lat="",lon="";
lat = a.getString(0);
lon = a.getString(1);
texto.setText(lat);
texto1.setText(lon);
} catch (JSONException e) {
e.printStackTrace();
}
}
Este es el codigo en el php:
while($arr = mysqli_fetch_array($resultset)) {
$arryItem["latitud"] = $arr["latitud"];
$arryItem["longitud"] = $arr["longitud"];
$arrRows[] = $arryItem;
}
echo json_encode($arrRows);
El echo json_encode($arrRows);
me da lo siguiente:
Como tendria que ser para que la latitud lo tenga en texto.setText(lat);
y la longitud lo tenga en texto1.setText(lon);