gpt4 book ai didi

android - 如何在android中发送post请求

转载 作者:行者123 更新时间:2023-11-29 22:52:18 24 4
gpt4 key购买 nike

如何在android中发送post请求我使用异步 http clint 库我将此方法用于 get,我需要将其用于 post

client.get(getString(R.string.server2) + "culture_types", new TextHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {

}

@Override
public void onSuccess(int statusCode, Header[] headers, String responseString) {


}
}
});

最佳答案

private static AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.put("param1", "Test"); // Put parameter name
client.post(Url, params, new TextHttpResponseHandler(){
@Override
public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {

}

@Override
public void onSuccess(int statusCode, Header[] headers, String responseString) {


}
}
});

关于android - 如何在android中发送post请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57772472/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com