java - new JSONArray(String[]) on Android -


i'm trying create jsonarray in file in linked folder android project, , eclipse (didn't before) giving me error : call requires api level 19 (current min 14): new org.json.jsonarray

the code happens following:

string[] s = (save_val.trim().equals(""))?new string[]{}:save_val.split("\n"); jsonobject o = null; if (!arrays.equals(s, save_names)){      new jsonarray(s); // error shown 

edit: solution method in fact isn't introduced before api 19, if use (as in case) string array or other promitives can do:

    jsonarray s_values = new jsonarray();     (int = 0; < s.length; i++){         s_values.put(yourarray[i]);     } 

this shouldn't slower

looks constructor jsonarray(object array) not introduced until api level 19.

http://developer.android.com/reference/org/json/jsonarray.html#jsonarray(java.lang.object)

you can change min api version in manifest 19 or

you can convert object array collection array arraylist , use collection array constructor of jsonarray available api 1.

good luck!


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -