private void getDataFromNet() { RequestParams params = new RequestParams(url); x.http().get(params, new Callback.CommonCallback<String>() { @Override public void onSuccess(String result) { Log.e(TAG, "联网成功==" + result); CacheUtils.putString(mActivity, url, result); processData(result); } @Override public void onError(Throwable ex, boolean isOnCallback) { Log.e(TAG, "联网请求失败onError==" + ex.toString() + ",isOnCallback==" + isOnCallback); } @Override public void onCancelled(CancelledException cex) { Log.e(TAG, "onCancelled==" + cex.toString()); } @Override public void onFinished() { Log.e(TAG, "onFinished=="); } }); }
使用xutils第三方库实现联网请求
最新推荐文章于 2023-05-26 21:36:44 发布