-
Get 同步请求
try { Response response = OkHttpClientManager.getAsyn("url"); String string = response.body().string(); } catch (IOException e) { e.printStackTrace(); }
-
Get 异步请求
OkHttpClientManager.getAsyn("url", new OkHttpClientManager.StringCallback() { @Override public void onFailure(Request request, IOException e) { } @Override public void onResponse(String response) { } });
-
post 同步请求
OkHttpClientManager.Param param = new OkHttpClientManager.Param(); try { Response response = OkHttpClientManager.post("url", param); String string = response.body().string();\ } catch (IOException e) { e.printStackTrace(); }
-
post 异步请求(键值对参数)
Map<String,String> map = new HashMap<>(); OkHttpClientManager.postAsyn("url", new OkHttpClientManager.StringCallback() { @Override public void onFailure(Request request, IOException e) { } @Override public void onResponse(String response) { } },map,null);
-
post 异步请求(Json 参数)
OkHttpClientManager.postJson("url", new OkHttpClientManager.StringCallback() { @Override public void onFailure(Request request, IOException e) { } @Override public void onResponse(String response) { } },new JSONObject());
-
post 异步请求(返回javabean对象)
Map<String,String> map = new HashMap<>(); OkHttpClientManager.postObject("url", new OkHttpCallBack<LoginBean>(new OkJsonParser<LoginBean>() { }) { @Override public void onSuccess(int code, LoginBean loginBean) { } @Override public void onFailure(Throwable e) { } },map,"");
forked from sunshine-sz/OkHttpUtils
-
Notifications
You must be signed in to change notification settings - Fork 3
MIkeeJY/OkHttpUtils-2
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
基于okhttp框架的封装,同步、异步get post请求,post请求返回javebean实体类,下载上传文件监听进度在UI进程中更新。
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Java 100.0%