0

I have this dummy response. I need to Show Result list in Spinner but with specific index. Like I don't want to show all list items in the spinner. I just wanted to show index 4,11,6 . How to sorting that.

{
"status": "OK",
"message": "Sucess",
"result": [
{
"id": 2,
"name": "DHAKA",
"countryId": "001"
},
{
"id": 4,
"name": "RAJSHAHI",
"countryId": "001"
},
{
"id": 11,
"name": "RANGPUR",
"countryId": "001"
},
{
"id": 6,
"name": "SYLHET",
"countryId": "001"
}
]
}
ayaz khan
  • 29
  • 7

1 Answers1

1
  • Maybe you should create a new list which only contains the items you want to display.
  • Create an adapter to display the items in spinner, so that you can handle the case and display items only according to the index that you want.
  • I have a list of Result. and Result list showing me the given list data. in those list data i dont want to showing them all. only specific two three data i want to show. Can you give me some example to understand the process? – ayaz khan Sep 02 '22 at 11:30
  • hey bro is it possible to show specific values from a list in Spinner? cause i didnt get the idea you suggested. – ayaz khan Sep 04 '22 at 16:50
  • the best solution, according to me, is to create a new list that only contains the values for the index you want to show. For the second suggested solution, checkout this solution - https://stackoverflow.com/a/35985073/12060353 Create an adapter based on ArrayAdapter and handle the case for indexes you want to show / hide. – abhishek mishra Sep 05 '22 at 10:11