Common4Android是一个通用Android工具库,包含网络库、线程管理器、常用Util工具、热修复,它拥有良好的架构,低耦合、高内聚,使用起来非常轻松。
- NetWork
HttpDataRequest request = new HttpDataRequest(); request.setTag(HttpTag.TEST); request.setSort(Constants.REQUEST_METHOD_GET); request.setGzip(true); request.setRetry(false); request.setNeedAuth(false); TaskManager.startHttpDataRequset(request, new HttpDataResponse() { @Override public void onHttpRecvOK(HttpTag tag, Object extraInfo, Object result) { DialogUtil.showToast(MainActivity.this, (String) result, Toast.LENGTH_LONG); } @Override public void onHttpRecvError(HttpTag tag, HttpCode retCode, String msg) { DialogUtil.showToast(MainActivity.this, "onHttpRecvError retCode:" + retCode + " msg:" + msg, Toast.LENGTH_LONG); } @Override public void onHttpRecvCancelled(HttpTag tag) { DialogUtil.showToast(MainActivity.this, "onHttpRecvCancelled", Toast.LENGTH_LONG); } });