本文整理汇总了Java中com.android.volley.toolbox.JsonArrayRequest.parseNetworkResponse方法的典型用法代码示例。如果您正苦于以下问题:Java JsonArrayRequest.parseNetworkResponse方法的具体用法?Java JsonArrayRequest.parseNetworkResponse怎么用?Java JsonArrayRequest.parseNetworkResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.volley.toolbox.JsonArrayRequest
的用法示例。
在下文中一共展示了JsonArrayRequest.parseNetworkResponse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defaultCharsetJsonArray
import com.android.volley.toolbox.JsonArrayRequest; //导入方法依赖的package包/类
@Test public void defaultCharsetJsonArray() throws Exception {
// UTF-8 is default charset for JSON
byte[] data = jsonArrayString().getBytes(Charset.forName("UTF-8"));
NetworkResponse network = new NetworkResponse(data);
JsonArrayRequest arrayRequest = new JsonArrayRequest("", null, null);
Response<JSONArray> arrayResponse = arrayRequest.parseNetworkResponse(network);
assertNotNull(arrayResponse);
assertTrue(arrayResponse.isSuccess());
assertEquals(TEXT_VALUE, arrayResponse.result.getString(TEXT_INDEX));
assertEquals(COPY_VALUE, arrayResponse.result.getString(COPY_INDEX));
}
示例2: specifiedCharsetJsonArray
import com.android.volley.toolbox.JsonArrayRequest; //导入方法依赖的package包/类
@Test public void specifiedCharsetJsonArray() throws Exception {
byte[] data = jsonArrayString().getBytes(Charset.forName("ISO-8859-2"));
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=iso-8859-2");
NetworkResponse network = new NetworkResponse(data, headers);
JsonArrayRequest arrayRequest = new JsonArrayRequest("", null, null);
Response<JSONArray> arrayResponse = arrayRequest.parseNetworkResponse(network);
assertNotNull(arrayResponse);
assertTrue(arrayResponse.isSuccess());
assertEquals(TEXT_VALUE, arrayResponse.result.getString(TEXT_INDEX));
// don't check the copyright symbol, ISO-8859-2 doesn't have it, but it has Czech characters
}