Created
April 25, 2017 16:53
-
-
Save hemant3370/570f4eec1c7530548eb123bea4f57655 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void getFeeds() { | |
if (mRetrofit == null){ | |
mRetrofit = RestClient.getClient(); | |
} | |
apiInterface = mRetrofit.create(ApiInterface.class); | |
Call<FeedResponse> call = apiInterface.getFeed(Initializer.readFromPreferences(getContext(), Constants.SPKeys.authTokenKey,"")); | |
call.enqueue(new retrofit2.Callback<FeedResponse>() { | |
@Override | |
public void onResponse(Call<FeedResponse> call, Response<FeedResponse> response) { | |
if (response.code() == 200 ){ | |
feed = response.body(); | |
mSectionsPagerAdapter.notifyDataSetChanged(); | |
} | |
else { | |
Toast.makeText(getActivity(),String.valueOf(response.raw().message()),Toast.LENGTH_LONG).show(); | |
} | |
} | |
@Override | |
public void onFailure(Call<FeedResponse> call, Throwable t) { | |
Toast.makeText(getActivity(),t.getLocalizedMessage(),Toast.LENGTH_LONG).show(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment