0

I am new to android development. I am stuck try to show dropdown's data into android . Data will come from server as a json format. I am using volley library for HTTP requests. Here is my volley response

{"blood_group_map":[{"value":"1","text":"O+"},{"value":"2","text":"O-"},{"value":"3","text":"A+"},{"value":"4","text":"A-"},{"value":"5","text":"B+"},{"value":"6","text":"B-"},{"value":"7","text":"AB+"},{"value":"8","text":"AB-"}]}

In this response I want draw blood_group_map key in Spinner option list like this HTML. Here value key is used for value and text key is used for display text.

<option value="1">O+</option>

Update:

I parsed this JSON but I want to send spiner value property to server and display text property. How can I send value to server not text ?

For Example if I select O+ blood group then I send spinner value 1 to server.
alien
  • 214
  • 1
  • 6
  • 12

1 Answers1

-1

Use GSON parser to parse data to from json.

Basic working of GSON is: you build an object with structure same as your json.

All you have to do is pass it to spinner. An example of GSON parser here: GSON parser example

Spinner example: Spinner example

woliveirajr
  • 9,433
  • 1
  • 39
  • 49