Я пытаюсь заполнить счетчик списком объектов, которые я получаю с сервера.проблема, я не получаю ответ от сервера, или я получаю весь ответ как одна строка
здесь json
{
"message": "SUCCESS",
"Speciality": [
{
"id": 5,
"MainSpecialityEn": "Specialized Surgery",
"MainSpecialityAr": "جراحة تخصصية"
},
{
"id": 15,
"MainSpecialityEn": "Pediatrics",
"MainSpecialityAr": "اطفال"
},
{
"id": 16,
"MainSpecialityEn": "Medicine",
"MainSpecialityAr": "طب"
},
{
"id": 17,
"MainSpecialityEn": "Other",
"MainSpecialityAr": "تخصصات أخرى"
},
{
"id": 18,
"MainSpecialityEn": "Radiology",
"MainSpecialityAr": "أشعة"
},
{
"id": 8,
"MainSpecialityEn": "Ophthalmology",
"MainSpecialityAr": "عيون"
}
]}
вот мой код.Я знаю, что это абсолютно неправильно
RequestQueue requestQueue = Volley.newRequestQueue(mContext);
// Initialize a new JsonArrayRequest instance
JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(
Request.Method.GET, mJSONURLString,
null,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
try{
// Loop through the array elements
for(int i=1;i<response.length();i++){
JSONObject student = response.getJSONObject(i);
String MainSpecialityEn = student.getString("MainSpecialityEn");
}
}catch (JSONException e){
e.printStackTrace();
}
}
},
new Response.ErrorListener(){
@Override
public void onErrorResponse(VolleyError error){
// Do something when error occurred
}
}
);
// Add JsonArrayRequest to the RequestQueue
requestQueue.add(jsonArrayRequest);
любая помощь, чтобы я мог получить список всех MainSpecialityEn в моем списке?спасибо