1. I am trying to use the results of a search and add the results to a list view.
2. I need to take the item click of the list view and send that string to the widget service.
I seem to get no items from the search.
I can not seem to manually insert item to listbox
all so on the widgetService i am trying to get the value of (cities) form the Main activity useing call sub it does not work.
Thanks for any help with this.
I attached the export.
I am useing the ICOWorldForecast lib to searh for a city.
<<<<<<<<<<<<Main>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<WidgetService>>>>>>>>>>>>>>>>>>
Any help would be GREAT to figure this out.
2. I need to take the item click of the list view and send that string to the widget service.
I seem to get no items from the search.
I can not seem to manually insert item to listbox
all so on the widgetService i am trying to get the value of (cities) form the Main activity useing call sub it does not work.
Thanks for any help with this.
I attached the export.
I am useing the ICOWorldForecast lib to searh for a city.
<<<<<<<<<<<<Main>>>>>>>>>>>>>>
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim lvCities As ListView
Dim I As Int
End Sub
Sub Globals
Dim cities As List
Dim lvCities As ListView
Dim Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("start")
'
End Sub
Sub lvCities_ItemClick (Position As Int, Value As Object)
Dim edtCity As EditText
Dim lvCities As ListView
' CallSub(WidgetService, "RefreshData")
WidgetService.str = lvCities.GetItem(Position)
' Activity.Finish
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Dim edtCity As EditText
edtCity.Initialize("")
lvCities.Initialize("")
lvCities.Initialize("lvcities")
' Manually insert item into ListView
lvCities.AddSingleLine("Wise,Virgina")
If edtCity.Text <> "" Then
lvCities.Clear
' search using edtCity.Text
cities =WidgetService.a.GetList("Wise,Va")
ToastMessageShow(cities,True)
For I = 0 To cities.Size - 1
lvCities.AddSingleLine(cities.Get(I))
Next
Else
ToastMessageShow("Enter a city", True)
End If
Msgbox("Go to the home screen and add the Hello Widget.", "")
End Sub
<<<<<<<<<<<<<<<WidgetService>>>>>>>>>>>>>>>>>>
B4X:
'Service module
Sub Process_Globals
Dim a As ICOSWorldForecast
Dim str As String
Dim rv As RemoteViews
Dim mGetList As String
Dim city As String
End Sub
Sub Service_Create
a.Initialize("a")
a.ApiKey="a8df9adcc5202329121911"
city= CallSub(Main,"cities")
a.CityName= city
rv = ConfigureHomeWidget("L1", "rv", 30, "ICOSForecastWeater")
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub
Sub rv_RequestUpdate
SetTime
rv.UpdateWidget
End Sub
Sub rv_Disabled
StopService("")
End Sub
Sub Service_Destroy
End Sub
Sub SetTime
rv.SetImage("ivicon",a.CCIcon)
rv.SetText("lbtemp", a.CCTempCelsius&"°")
'rv.SetText("lbcity", str)
End Sub
Any help would be GREAT to figure this out.