Code example for JSONArray

Methods: getJSONArray, length, put

0
                HashMap<String, Object> args = new HashMap<String, Object>();
                args.put("channel", channel);
                args.put("count", 5);
 
                JSONArray responce = pubnub.detailedHistory(args);
                JSONArray history = responce.getJSONArray(0);
 
                CommonUtil.LogPass(history.length() == 5,"test_count");
                 
            } catch (JSONException e) {
                e.printStackTrace();
            } 
        } 
 
        private void test_count_zero() { 
            try { 
                 
                HashMap<String, Object> args = new HashMap<String, Object>();
                args.put("channel", channel);
                args.put("count", 0);
 
                JSONArray responce = pubnub.detailedHistory(args);
                JSONArray history = responce.getJSONArray(0);
 
                CommonUtil.LogPass(history.length() == 0,"test_count_zero");
                 
            } catch (JSONException e) {
                e.printStackTrace();
            } 
        } 
 
         
    }