Code example for JSONArray

0
 
    @Override 
    public JSONArray getJSONArray(String key, JSONArray defValue) {
        String s = prefs.getString(key, null);
        try { 
            return s == null ? defValue : new JSONArray(s);
        } catch (JSONException e) {
            return new JSONArray();
        } 
    } 
 
    @Override 
    public JSONObject getJSONObject(String key, JSONObject defValue) {
        String s = prefs.getString(key, null);
        try { 
            return s == null ? defValue : new JSONObject(s);
        } catch (JSONException e) {
            return new JSONObject();
        } 
    } 
Experience pair programming with AI  Get Codota for Java