Ich versuche Json Array
in recyclerview
mit volley
in android
zu analysieren, aber es zeigen weniger Daten als auf dem Server. ich meine es nur 4 Daten analysieren, Server haben 10. warum? Code:Analysieren von JSON Array in Recyclerview mit Volley, warum zeigt es weniger Daten als auf dem Server?
JsonObjectRequest jsonObjectReq = new JsonObjectRequest (Request.Method.GET, url, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject data, deal_mode;
String total, ref, name,category_name,start_date,end_date,offer_price,market_price,gain,structure_note,other_note;
data = resp.getJSONObject("data");
total = data.getString("total");
JSONArray data1 = data.getJSONArray("data");
try {
for (int i = 0; i <response.length(); i++) {
JSONObject jresponse = data1.getJSONObject(i);
ref = jresponse.getString("ref");
name = jresponse.getString("name");
deal_mode = jresponse.getJSONObject("deal_mode");
category_name=deal_mode.getString("category_name");
start_date=jresponse.getString("start_date");
end_date=jresponse.getString("end_date");
offer_price=jresponse.getString("offer_price");
market_price=jresponse.getString("market_price");
gain=jresponse.getString("gain");
structure_note=jresponse.getString("structure_note");
other_note=jresponse.getString("other_note");
Toast.makeText(getApplication(), name, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getApplication(), error.toString(), Toast.LENGTH_LONG).show();
}
}) {
//This is for Headers
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> params = new HashMap<String, String>();
params.put("Content-Type", "application/json; charset=UTF-8");
params.put("Authorization", "Bearer" + getToken);
return params;
}
};
//Add the Request to the RequestQueue.
VolleySingleton.getInstance(getApplicationContext()).addToRequestQueue(jsonObjectReq, REQUEST_TAG);
wo ist dein Code ...? – Prem
Dinesh bitte poste deinen Code für bessere Referenz –