0
My JSON returns more than one number. How to receive all and not one?
I would like to set the return on one TextView
. How to make it return all values and not only the first?
JSONObject json = new JSONObject(result);
JSONArray array = new JSONArray(json.getString("resource"));
for (int i = 0; i < array.length(); i++) {
JSONObject jsonObj = array.getJSONObject(i);
mId_user = jsonObj.getString("id_user");
mValorAnuncioVenda = jsonObj.getString("vl_anuncio");
mNegativo = jsonObj.getString("vl_pago");
mIdComp = jsonObj.getString("id_user_comp");
if ((mIdComp != null) & (mNegativo != null)) {
mPositivo = mNegativo;
negativo.setText(mPositivo);
}
It wasn’t clear what you want. You just posted an excerpt of code that doesn’t finish. What would be the return value? That code there is inside some method?
– Márcio Oliveira