0

I'm working on a project using the Riot Games API, and have run into an issue. I'm able to receive and deserialize info using the "summoner" api call, but I cannot replicate my success with the "game" api call. Here is how I am attempting to receive the list from the Api.

       var client = new RestClient("https://na.api.pvp.net");
        RestRequest request = new RestRequest("/api/lol/na/v1.3/game/by-summoner/" + idReceived + "/recent?<my api key here>", Method.GET);
        request.AddHeader("Content-type", "application/json");

        var response = client.Execute<RecentGames>(request);
        var recentGames = JsonConvert.DeserializeObject<RecentGames>(response.Content).games;

Once I have my recentGames, I am trying to put it into a ListView I have created as follows.

    ListAdapter = new ArrayAdapter<Game>(this, Android.Resource.Layout.SimpleListItem1, recentGames);

The app runs fine until it hits the line of code above. Once it attempts to put the recentGames into a list the app crashes.

I've been able to add an empty list of Game to the ListAdapter and it worked fine. So I'm sort of stumped on where I'm going wrong. Any point in the right direction would help greatly!

  • What's the error you are receiving? – pinedax Feb 18 '17 at 23:44
  • I'm not getting an error, the app is just crashing. I believe the issue is with the response. If I do not include my apikey I receive a 403 error as expected, so I AM hitting the api, so I believe my issues lies in "response". If I comment out response the app doesn't crash. – GarlicAfterTaste Feb 18 '17 at 23:59
  • Debug the app and put a break point over the reponse. Also in the application output you can get the reason of the crash. – pinedax Feb 19 '17 at 00:25

0 Answers0