}
@Override
public void onResponse(Call call, Response response) throws IOException {
}
});
}
所以我们还有一种方式可以装取键值对,通过ArrayList这样的数据结构。
//首先要有一个RequestParameter类
public class RequestParameter implements Serializable {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
private String name;
private String value;
public RequestParameter(String name,String value){
this.name=name;
this.value=value;
}
}
List parameter=new ArrayList<>();
RequestParameter rp1=new RequestParameter(“name”,“哈哈”);
parameter.add(rp1);
RequestParameter rp2=new RequestParameter(“client”,“Android”);
parameter.add(rp2);
//创建一个FormBody.Builder
FormBody.Builder builder=new FormBody.Builder();
if (parameter!=null&¶meter.size()>0){
for (final RequestParameter p : parameter) {
bu