I'm getting an int
value from my getProfileIconId()
call to an API and that int
represents that player's profile icon. My question is, how do i use that value to set the appropriate icon for an ImageView
in my layout since i don't have that icon stored locally? Should i somehow download it,store it in the user's storage and use the int to retrieve it and if so how should i go about doing that? Is there some other way to do this,am i ignoring something?
private class DownloadSummonerData extends AsyncTask<Void, Void, Integer> {
protected Integer doInBackground(Void... urls) {
ApiConfig config = new ApiConfig().setKey(API_KEY);
RiotApi api = new RiotApi(config);
Summoner summoner = null;
try {
summoner = api.getSummonerByName(Platform.EUNE, "XmaxUniverse");
} catch (RiotApiException e) {
e.printStackTrace();
}
return summoner.getProfileIconId();
}
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
imageView.setImageResource(result);
}
}