-3

I want to fetch string values from a JSON-array and set it to a spinner in Android. How can I do this?

`{"languages":["English","Hindi","Punjabi","",""]} `languages":["English","Hindi","Punjabi","",""]} 
Jota
  • 17,281
  • 7
  • 63
  • 93
Kartik Setia
  • 31
  • 1
  • 8

1 Answers1

1

You can parse your JSONARRAY like this

if (jsonResultArry != null) {
            for (int i = 0; i < jsonResultArry.length(); i++) {

                try {

                JsonObject jsonPblm = jsonResultArry.getJSONObject(i);
                    pblmId = jsonPblm.getString("id");
                    ticketDate = jsonPblm.getString("ticket_date");
                    pblmName = jsonPblm.getString("description");

                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
madhu527
  • 4,644
  • 1
  • 28
  • 29