use of io.openkit.OKAchievementsListResponseHandler in project openkit-android by OpenKit.
the class OKAchievementsFragment method getAchievements.
private void getAchievements() {
spinnerBar.setVisibility(View.VISIBLE);
OKAchievement.getAchievements(new OKAchievementsListResponseHandler() {
@Override
public void onSuccess(List<OKAchievement> achievementList) {
listAdapter = new OKAchievementsListAdapter(OKAchievementsFragment.this.getActivity(), android.R.layout.simple_list_item_1, achievementList);
numAchievements = achievementList.size();
listHeaderTextView.setText(numAchievements + " Achievements");
OKAchievementsFragment.this.setListAdapter(listAdapter);
listView.setVisibility(View.VISIBLE);
spinnerBar.setVisibility(View.INVISIBLE);
}
@Override
public void onFailure(Throwable e, JSONObject errorResponse) {
spinnerBar.setVisibility(View.INVISIBLE);
if (OKAchievementsFragment.this.getActivity() != null) {
Toast toast = Toast.makeText(OKAchievementsFragment.this.getActivity(), "Couldn't connect to server to get achivements", Toast.LENGTH_LONG);
toast.show();
}
}
});
startedAchievementsRequest = true;
}
Aggregations