@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = getActivity(); username = PreferenceUtil.getString(mContext, Const.USERNAME, null); mHandler = new Handler(); }
private ApiManager() { mContext = GithubApplication.getInstance(); mAccessToken = PreferenceUtil.getString(mContext, Const.ACCESS_TOKEN_KEY, null); OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setReadTimeout(60, TimeUnit.SECONDS); okHttpClient.setConnectTimeout(60, TimeUnit.SECONDS); mRestAdapter = new RestAdapter.Builder() .setRequestInterceptor(mRequestInterceptor) .setEndpoint(API_URL) .setClient(new OkClient(okHttpClient)) .build(); mGithubApi = mRestAdapter.create(GithubApi.class); }