I am trying to make an application that will let me track the statistics of a certain user on the game League of Legends using the Riot Games API. I have made a method that will allow me to parse the number of wins and losses from the servers and calculate the ratio between them, but I need to call it from inside onCreate, or any other method that I'll be able to call from onCreate.
Here is the method :
public static void checkStats(String[] args) throws RiotApiException {
RiotApi api = new RiotApi("DEVELOPER KEY REDACTED");
Summoner summoner = api.getSummonerById(Region.EUW, "ID REDACTED");
RankedStats statsRanked = api.getRankedStats(Region.EUW, summoner.getId());
AggregatedStats rankedStats = statsRanked.getChampions().get(0).getStats();
wins = rankedStats.getTotalSessionsWon();
losses = rankedStats.getTotalSessionsLost();
ratio = wins / losses;
ratioView.setText(wins + " / " + losses + " | " + "Ratio : " + ratio);
}
wins, losses, ratio and ratioView are all defined above in the code :
static int points, wins, losses, ratio, BOtarget, BOwins, BOlosses, BOprogress;
static TextView ratioView;
I am trying to call this method by using this line, but it says checkstats(String[]) cannot be applied to checkstats() :
checkStats();
So I tried to use :
checkstats(null);
But now, I get an Unhandled exception :
Unhandled exception: net.rithms.RiotApiException
All imports related to the API are correctly done.
For reference, I am following this example : https://github.com/taycaldwell/riot-api-java/blob/master/examples/RankedWinsAndLosses.java
Thank you for your help.
EDIT : entire activity code : http://pastebin.com/2f65WTWN