I am making a Android app and I am populating a spinner from a web service, the response looks like this this:
[
{
"Text":"Business Critical",
"Value":"3"
},
{
"Text":"Business Urgent",
"Value":"4"
},
{
"Text":"User Urgent",
"Value":"5"
},
{
"Text":"Normal",
"Value":"6"
},
{
"Text":"Low",
"Value":"7"
}
]
I am making a second request to get the ticket details which looks like this:
{
"AssignedTo":"John Doe",
"Id":33258,
"Priority":"Low",
}
I am setting the "Id" and "AssignedTo" in EditText boxes like so:
StringRequest myTicketRequest = new StringRequest(Request.Method.GET, ticketDetailUrl, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try{
JSONObject ticket = new JSONObject(response);
if(ticket.has("Subject"))
assignedTxt.setText(ticket.getString("AssignedTo"));
if(ticket.has("Description"))
idTxt.setText(ticket.getString("Id"));
//Set Category here
}catch (JSONException e){e.printStackTrace();}
So my question is how do I set the spinner to the "Priority" in my second request which is equal to "Low" in the spinner?
Thanks in advance.