Hi All,
I want to develop a widget to update a label text from a given web site every 5 mins. I know how to load a html source from a standard program (not widget), see below code. However, I don't know how to put it in widget. Does anybody give me some advice?
Regards,
Kit
I want to develop a widget to update a label text from a given web site every 5 mins. I know how to load a html source from a standard program (not widget), see below code. However, I don't know how to put it in widget. Does anybody give me some advice?
Regards,
Kit
B4X:
'Activity module
Sub Process_Globals
Dim PhoneIntents1 As PhoneIntents
Dim MainUrl As String
End Sub
Sub Globals
Dim ListView1 As ListView
Dim WebView1 As WebView
Dim Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout("form1")
HttpUtils.CallbackActivity = "Main"
HttpUtils.CallbackJobDoneSub = "JobDone"
MainUrl = "http://news.google.com.hk/news?edchanged=1&ned=us"
HttpUtils.Download("Main page", MainUrl)
End Sub
Sub Activity_Resume
End Sub
Sub JobDone(Job As String)
Select job
Case "Main page"
Load_Details
End Select
End Sub
Sub Load_Details
Dim TextReader1 As TextReader
TextReader1.Initialize2(HttpUtils.GetInputStream(MainUrl),"utf8")
line = TextReader1.ReadAll
TextReader1.Close
Label1.Text = line
End Sub