Java Code Examples for com.android.volley.toolbox.JsonArrayRequest#parseNetworkResponse()
The following examples show how to use
com.android.volley.toolbox.JsonArrayRequest#parseNetworkResponse() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonRequestCharsetTest.java From device-database with Apache License 2.0 | 5 votes |
@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)); }
Example 2
Source File: JsonRequestCharsetTest.java From device-database with Apache License 2.0 | 5 votes |
@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 }
Example 3
Source File: JsonRequestCharsetTest.java From product-emm with Apache License 2.0 | 5 votes |
@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)); }
Example 4
Source File: JsonRequestCharsetTest.java From product-emm with Apache License 2.0 | 5 votes |
@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 }
Example 5
Source File: JsonRequestCharsetTest.java From product-emm with Apache License 2.0 | 5 votes |
@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)); }
Example 6
Source File: JsonRequestCharsetTest.java From product-emm with Apache License 2.0 | 5 votes |
@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 }
Example 7
Source File: JsonRequestCharsetTest.java From CrossBow with Apache License 2.0 | 5 votes |
@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)); }
Example 8
Source File: JsonRequestCharsetTest.java From CrossBow with Apache License 2.0 | 5 votes |
@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 }