Skip to content

merlin720/network

Repository files navigation

network

这是一个volley和okhttp封装的网络请求框架,请求和response由okhttp完成,因为他安全,而分发则交给volley.

you can use with gradle

compile 'com.merlin.network:network:1.0.0

首先要初始化一下

NetworkMgr.getInstance().init(this,true);

调用的代码也很简单

    NetworkDelegate.getInstance().get(String.class, "http://www.weather.com.cn/data/cityinfo/101010100.html", new HashMap<String, Object>(), new CallBack<String>() {
                        @Override
                        public void onResponse(String response) {
                        }
    @Override
    public void onFailure(Exception exception) {

    }
});

第一个参数是请求返回接口的bean,第二个参数是url,第三个请求需要的参数,第四个是一个回调

wiki

Releases

No releases published

Packages

No packages published

Languages