OK trying to use the new API to pull users videos however using the Android volley Method i getting no response, states index 0 of 0.
the user in question has videos so it should have responses.
example of my code
String url = "https://api.twitch.tv/helix/videos?user_id=64578628";
// Request a string response from the provided URL.
final JsonObjectRequest DivanRequest = new JsonObjectRequest
(com.android.volley.Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
JSONObject jsonObject = response;
JSONArray JA = jsonObject.getJSONArray("data");
for (int i = 0; i < response.length(); i++) {
JSONObject object = JA.getJSONObject(i);
String Name = object.getString("title");
aldrenTitle.append(Name);
}
JSONObject jsonObject2 = response;
JSONArray JA2 = jsonObject2.getJSONArray("data");
for (int i = 0; i < response.length(); i++) {
JSONObject object = JA2.getJSONObject(i);
String Time = object.getString("duration");
aldrenTime.append(Time);
}
JSONObject jsonObject3 = response;
JSONArray JA3 = jsonObject3.getJSONArray("data");
for (int i = 0; i < response.length(); i++) {
JSONObject object = JA3.getJSONObject(i);
String Image = object.getString("thumbnail_url");
new DownLoadImageTask(aldrenVideo).execute(Image);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
Log.e("VOLLEY", "ERROR");
}
})
{ //this is the part, that adds the header to the request
@Override
public Map<String, String> getHeaders() {
Map<String, String> params = new HashMap<String, String>();
params.put("Client-ID", "actual client id");
params.put("content-type", "application/json");
return params;
}
};
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0