【问题标题】:Returning server data using Volley - Android使用 Volley 返回服务器数据 - Android
【发布时间】:2017-12-17 00:33:31
【问题描述】:

我有一个 Android 应用程序,它在服务器上发出一些请求,并使用 Volley 库通过 Web 服务发送数据。

应用程序发送的数据由API接收,当有确认时,API返回特定值。

我的问题是我没有从 API 获得这个特定的回报。我如何获得此返回,而不仅仅是库默认接收的服务器响应 200 返回?

【问题讨论】:

标签: android web-services android-volley


【解决方案1】:

你需要重写 parseNetworkResponse(NetworkResponse response)

示例:

@Override
protected Response<Bitmap> parseNetworkResponse(NetworkResponse response) {
    // Serialize all decode on a global lock to reduce concurrent heap usage.
        try {
            return doParse(response); //your parser function 
        } catch (OutOfMemoryError e) {
            //..Catch
        }

}

看一下文档。

希望对你有帮助,

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多