【发布时间】:2017-12-17 00:33:31
【问题描述】:
我有一个 Android 应用程序,它在服务器上发出一些请求,并使用 Volley 库通过 Web 服务发送数据。
应用程序发送的数据由API接收,当有确认时,API返回特定值。
我的问题是我没有从 API 获得这个特定的回报。我如何获得此返回,而不仅仅是库默认接收的服务器响应 200 返回?
【问题讨论】:
标签: android web-services android-volley
我有一个 Android 应用程序,它在服务器上发出一些请求,并使用 Volley 库通过 Web 服务发送数据。
应用程序发送的数据由API接收,当有确认时,API返回特定值。
我的问题是我没有从 API 获得这个特定的回报。我如何获得此返回,而不仅仅是库默认接收的服务器响应 200 返回?
【问题讨论】:
标签: android web-services android-volley
你需要重写 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
}
}
看一下文档。
希望对你有帮助,
【讨论】: