Android JSON Insert concatArray(JSONArray arr1, JSONArray arr2)

Here you can find the source of concatArray(JSONArray arr1, JSONArray arr2)

Description

concat Array

Declaration

public static JSONArray concatArray(JSONArray arr1, JSONArray arr2)
            throws JSONException 

Method Source Code

//package com.java2s;

import org.json.JSONArray;
import org.json.JSONException;

public class Main {
    public static JSONArray concatArray(JSONArray arr1, JSONArray arr2)
            throws JSONException {
        JSONArray result = new JSONArray();
        for (int i = 0; i < arr1.length(); i++) {
            result.put(arr1.get(i));//from  w ww.j ava2  s  . com
        }
        for (int i = 0; i < arr2.length(); i++) {
            result.put(arr2.get(i));
        }
        return result;
    }
}

Related

  1. insertJSONArrayContent( ContentResolver contentResolver, Uri uri, JSONArray array)
  2. insertJSONObjectContent( ContentResolver contentResolver, Uri uri, JSONObject obj)