How to use the Volley Library to parse a JSON array?
<p>Here is the json: <a href="https://api.jamendo.com/v3.0/tracks/?client_id=70c68f47&amp;format=jsonpretty&amp;limit=200&amp;search=disco" rel="nofollow">https://api.jamendo.com/v3.0/tracks/?client_id=70c68f47&amp;format=jsonpretty&amp;limit=200&amp;search=disco</a></p>

<p>My question is how to make parsing method correct with this solution what I have. I don't have any additional rest adapter, volley should get JSON from this API.</p>

<p>Anybody will help me to remake first code, to work with this API?</p>

<p>Here is request what I am trying to change for parsing this API:</p>

<pre><code>JsonArrayRequest movieReq = new JsonArrayRequest(url,
            new Response.Listener&lt;JSONArray&gt;() {
                @Override
                public void onResponse(JSONArray response) {
                    Log.d(TAG, response.toString());
                    hidePDialog();


                    // Parsing json
                    for (int i = 0; i &lt; response.length(); i++) {
                        try {

                            JSONObject obj = response.getJSONObject(i);
                            JSONArray jsonArray = obj.getJSONArray("results");
                            for (int i2 = 0; i2 &lt; jsonArray.length(); i2++) {
                                JSONObject jsonObject3 = jsonArray.getJSONObject(i2);
                                DataModelList movie = new DataModelList();
                                movie.setTitle(obj.getString("name"));
                                movie.setThumbnailUrl(obj.getString("image"));
                                movie.setRating(((Number) obj.get("id"))
                                        .doubleValue());
                                movie.setYear(obj.getInt("releasedate"));
                                movieList.add(movie);
                            }



                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }
</code></pre>

<p>Data Model:</p>

<pre><code>public class DataModelList {
private String title, thumbnailUrl;
private int year;
private double rating;
private ArrayList&lt;String&gt; genre;

public DataModelList() {
}

public DataModelList(String name, String thumbnailUrl, int year, double rating,
             ArrayList&lt;String&gt; genre) {
    this.title = name;
    this.thumbnailUrl = thumbnailUrl;
    this.year = year;
    this.rating = rating;
    this.genre = genre;
}

public String getTitle() {
    return title;
}

public void setTitle(String name) {
    this.title = name;
}

public String getThumbnailUrl() {
    return thumbnailUrl;
}

public void setThumbnailUrl(String thumbnailUrl) {
    this.thumbnailUrl = thumbnailUrl;
}

public int getYear() {
    return year;
}

public void setYear(int year) {
    this.year = year;
}

public double getRating() {
    return rating;
}

public void setRating(double rating) {
    this.rating = rating;
}

}
</code></pre>

<p>Adapter List:</p>

<pre><code>public class AdapterDataList extends BaseAdapter {
private Activity activity;
private LayoutInflater inflater;
private List&lt;DataModelList&gt; movieItems;
ImageLoader imageLoader = ControllerSingleton.getInstance().getImageLoader();

public AdapterDataList(Activity activity, List&lt;DataModelList&gt; movieItems) {
    this.activity = activity;
    this.movieItems = movieItems;
}

@Override
public int getCount() {
    return movieItems.size();
}

@Override
public Object getItem(int location) {
    return movieItems.get(location);
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if (inflater == null)
        inflater = (LayoutInflater) activity
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    if (convertView == null)
        convertView = inflater.inflate(R.layout.list_row, null);

    if (imageLoader == null)
        imageLoader = ControllerSingleton.getInstance().getImageLoader();
    NetworkImageView thumbNail = (NetworkImageView) convertView
            .findViewById(R.id.thumbnail);
    TextView title = (TextView) convertView.findViewById(R.id.title);
    TextView rating = (TextView) convertView.findViewById(R.id.rating);
    TextView genre = (TextView) convertView.findViewById(R.id.genre);
    TextView year = (TextView) convertView.findViewById(R.id.releaseYear);

    // getting movie data for the row
    DataModelList m = movieItems.get(position);

    // thumbnail image
    thumbNail.setImageUrl(m.getThumbnailUrl(), imageLoader);

    // title
    title.setText(m.getTitle());

    // rating
    rating.setText("Rating: " + String.valueOf(m.getRating()));

    // genre


    // release year
    year.setText(String.valueOf(m.getYear()));

    return convertView;
}

}
</code></pre>

<p>Overall Fragment where I want to parse this JSON:</p>

<pre><code>public class FirstFragment extends Fragment{
private static final String TAG = "log";
private static final String url = "https://api.jamendo.com/v3.0/tracks/?client_id=70c68f47&amp;format=jsonpretty&amp;limit=200&amp;search=disco";
private ProgressDialog pDialog;
private List&lt;DataModelList&gt; movieList = new ArrayList&lt;DataModelList&gt;();
private ListView listView;
private AdapterDataList adapter;
public FirstFragment() {


}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    return inflater.inflate(R.layout.first_fragment, container, false);
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    listView = (ListView) getView().findViewById(R.id.list);

    adapter = new AdapterDataList(getActivity(),movieList);
    listView.setAdapter(adapter);

    pDialog = new ProgressDialog(getActivity());
    // Showing progress dialog before making http request
    pDialog.setMessage("Loading...");
    pDialog.show();
    JsonArrayRequest movieReq = new JsonArrayRequest(url,
            new Response.Listener&lt;JSONArray&gt;() {
                @Override
                public void onResponse(JSONArray response) {
                    Log.d(TAG, response.toString());
                    hidePDialog();


                    // Parsing json
                    for (int i = 0; i &lt; response.length(); i++) {
                        try {

                            JSONObject obj = response.getJSONObject(i);
                            JSONArray jsonArray = obj.getJSONArray("results");
                            for (int i2 = 0; i2 &lt; jsonArray.length(); i2++) {
                                JSONObject jsonObject3 = jsonArray.getJSONObject(i2);
                                DataModelList movie = new DataModelList();
                                movie.setTitle(obj.getString("name"));
                                movie.setThumbnailUrl(obj.getString("image"));
                                movie.setRating(((Number) obj.get("id"))
                                        .doubleValue());
                                movie.setYear(obj.getInt("releasedate"));
                                movieList.add(movie);
                            }



                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }

                    // notifying list adapter about data changes
                    // so that it renders the list view with updated data
                    adapter.notifyDataSetChanged();
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            VolleyLog.d(TAG, "Error: " + error.getMessage());
            hidePDialog();

        }
    });

    // Adding request to request queue
    ControllerSingleton.getInstance().addToRequestQueue(movieReq);

}


private void hidePDialog() {
    if (pDialog != null) {
        pDialog.dismiss();
        pDialog = null;
    }
}

}
</code></pre>