本文整理匯總了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
}