I am returning data from weatherunderground.com. I want to pass it to a weather class and get back the changed values (primarily for a practice exercise). However for the life of me I can't get the data into the class.
My data comes into my program as a map and works OK
Happily textstuff returns the temp.
However if I pass it to the Weather class in the same sub nothing happens.
The weather Class
It all looks OK for me I can't see what is missing. It like something isn't connected. it doesn't give any errors. Just sits there .. mute ....
The last class I tried to make had the same problem.
It seems pretty straightforward.
My data comes into my program as a map and works OK
B4X:
textstuff = m.Get("temp_c") & " " & m.Get("wind_string")
Happily textstuff returns the temp.
However if I pass it to the Weather class in the same sub nothing happens.
B4X:
Dim myweather As weather
myweather.Initialize( m.Get("temp_c"), m.Get("relative_humidity"), m.Get("wind_dir"), m.Get("wind_kph") , m.Get("windchill_c") , m.Get("feelslike_c") , m.Get("precip_today_string") ,m.Get("icon_url"))
lblweather.text = myweather.temp_c &" " & myweather.wind_dir
The weather Class
B4X:
Sub Class_Globals
'internal _private variables
Private m_temp_C As String
Private m_relative_humidity As String
Private m_wind_dir As String
Private m_wind_kph As String
Private m_windchill_c As String
Private m_feelslike_c As String
Private m_precip_today_string As String
Private m_icon_url As String
Private m_tempold As String
End Sub
'Initializes the object. You can add parameters to this method if needed. 'data goes in through temp_C and relative_humidity to _temp_C and _relative_humidity
Sub Initialize(temp_c As String,relative_humidity As String, wind_dir As String,wind_kph As String,windchill_c As String,feelslike_c As String,precip_today_string As String,icon_url As String)
m_temp_C = temp_c
Log("1 " & m_temp_C)
m_relative_humidity = relative_humidity
m_wind_dir = wind_dir
m_wind_kph = wind_kph
m_windchill_c = windchill_c
m_feelslike_c = feelslike_c
m_precip_today_string = precip_today_string
m_icon_url = icon_url
m_tempold = temp_c
End Sub
Sub temp_c
Dim temp As String
temp = m_temp_C &" C"
Return temp
End Sub
Sub tempchange
'nothing
End Sub
Sub relative_humidity
Return m_relative_humidity
End Sub
Sub wind_dir
Return m_wind_dir
End Sub
Sub wind_kph
Return m_wind_kph
End Sub
Sub windchill_c
Return m_windchill_c
End Sub
Sub feelslike_c
Return m_feelslike_c
End Sub
Sub precip_today_string
Return m_precip_today_string
End Sub
Sub icon_url
Return m_icon_url
End Sub
It all looks OK for me I can't see what is missing. It like something isn't connected. it doesn't give any errors. Just sits there .. mute ....
The last class I tried to make had the same problem.
It seems pretty straightforward.
Attachments
Last edited: