簡體   English   中英

使用名稱值對的Android排球請求

[英]Android volley post request using name value pairs

我正在使用排球庫向服務器發出發布請求。 該庫使用Map<String, String>作為post參數。 我的問題是想要為同一個鍵設置多個值,可以使用NameValuePairs但不能與volley一起使用。 提前致謝!

嘗試覆蓋下面的方法,它來自源代碼:

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
    Map<String, String> params = getParams();
    if (params != null && params.size() > 0) {
        return encodeParameters(params, getParamsEncoding());
    }
    return null;
}

返回要發送的原始POST或PUT正文。

所以用你的參數覆蓋getBody()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM