Android Question http getstring in autocomplete setitems

Kiran Raotole

Active Member
Licensed User
I got http.getstring == [{"place_return":",'','a place','b place','c place'"}] like this

and i have to insert it into autocomplete.setitem()
I tried like this ::
Dim p As JSONParser
p.Initialize(Job.GetString)
Dim list1 As List
list1 = p.NextArray
Dim map1 As Map
map1 = list1.Get(0)
AutoCompleteEditText1.SetItems(map1.Get("place_return"))

but it not works log show error = java.lang.ClassCastException: anywheresoftware.b4a.objects.collections.Map$MyMap cannot be cast to java.util.List

what is solution?
 

npsonic

Active Member
Licensed User
AutoCompleteEditText method SetItems need List.
 
Upvote 0

npsonic

Active Member
Licensed User
You can always create your own parser for the job.
 
Last edited:
Upvote 0

Kiran Raotole

Active Member
Licensed User
Ok. Take this like.
I have a list in a string.
Example a = "' ','a city','b city','c city'"
I want to use this string in AutoCompleteEditText1.SetItems
so i write it as
AutoCompleteEditText1.SetItems(Array As String(a))
but show only one string.
I want each city in autocomplete
 
Upvote 0

npsonic

Active Member
Licensed User
Ok. Take this like.
I have a list in a string.
Example a = "' ','a city','b city','c city'"
I want to use this string in AutoCompleteEditText1.SetItems
so i write it as
AutoCompleteEditText1.SetItems(Array As String(a))
but show only one string.
I want each city in autocomplete
B4X:
Dim items As List
items.Initialize
Do While a.Contains(",")
    a = a.SubString(a.IndexOf("'") + 1)
    items.Add(a.SubString2(0, a.IndexOf("'")))
    a = a.SubString(a.IndexOf(",") + 1)
Loop
a = a.SubString(a.IndexOf("'") + 1)
items.Add(a.SubString2(0, a.IndexOf("'")))
AutoCompleteEditText1.SetItems(items)
 
Upvote 0
Top