https://blog.csdn.net/huanglei201502/article/details/48974483
加入封装文件:
代码:
OkHttpClientManager.postAsyn(url,new OkHttpClientManager.ResultCallback<String>() {
@Override
public void onError(Request request,Exception e) {
e.printStackTrace();
Log.d("user",e.toString());
}
@Override
public void onResponse(String response) {
Toast.makeText(MainActivity.this,response,Toast.LENGTH_SHORT).show();
}
},new OkHttpClientManager.Param("username",username),new OkHttpClientManager.Param("password",password));
更新:
emmmm...后来感觉不太对啊,jsonString没用到都。。
https://www.cnblogs.com/liuzhen1995/p/8506075.html
于是,重新找了一个okhttp3的,
首先导入依赖。