How to convert single string to JsonArray in android?

前端 未结 2 473
时光说笑
时光说笑 2021-01-25 00:08

I need to convert a String[] to an JsonArray and I don\'t know how. I am new in android development i want to insert call log details in MySQL database. so, from android side i

2条回答
  •  盖世英雄少女心
    2021-01-25 00:42

    It is easy.You can use one of the constructors of JSONArray class.

    JSONArray jArr = new JSONArray(strArr)
    

    where strArr is your String array.

    More here: https://developer.android.com/reference/org/json/JSONArray.html#JSONArray(java.lang.Object)

提交回复
热议问题