Hallo Community!
Normally I do standard Android Apps.
But now I wanted to do a widget for my taughter she went for nine
month to india with an europian organization to work in a hospital.
So I did a widget which is a count down showing the time till she will
come back and has a link to her blog. Installation works and also after starting the widget it works but after a few minutes or hours it freezes.
Please help find encloused the project.
The Main Module:
Thx for your helpin advance
Georg
Normally I do standard Android Apps.
But now I wanted to do a widget for my taughter she went for nine
month to india with an europian organization to work in a hospital.
So I did a widget which is a count down showing the time till she will
come back and has a link to her blog. Installation works and also after starting the widget it works but after a few minutes or hours it freezes.
Please help find encloused the project.
The Main Module:
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.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim ImageView1 As ImageView
Dim lblDay As Label
Dim lblHour As Label
Dim lblMin As Label
Dim RetDate As Long
Dim Label1 As Label
Dim Label2 As Label
Dim lblHeader As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
The Service:
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim rv As RemoteViews
'Timer for Widget update
Dim Timer1 As Timer
End Sub
Sub Service_Create
rv = ConfigureHomeWidget("JCIDesign", "rv", 0, "JennyCountDownWidget")
Timer1.Initialize("Timer1",20000)
Timer1.Enabled = True
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub
Sub rv_RequestUpdate
'Ankunftsdatum
Dim RetDate As Long
'RealTime
Dim NowDate As Long
'Differenz in Ticks as seconds
Dim RetDiff As Long
'Timer Widget update
RetDate= DateTime.DateParse("05/31/2013") + (DateTime.TicksPerHour * 18) + (DateTime.TicksPerMinute * 30)
NowDate = DateTime.Now
RetDiff = (RetDate-NowDate)
Dim TheDays As Int
TheDays = RetDiff / DateTime.TicksPerDay
rv.SetText("lblDay",TheDays)
Dim TheHours As Int
TheHours = (RetDiff - (TheDays*DateTime.TicksPerDay))/DateTime.TicksPerHour
rv.SetText("lblHour",TheHours)
Dim TheMins As Int
TheMins = ((RetDiff - (TheDays*DateTime.TicksPerDay))- (TheHours*DateTime.TicksPerHour) )/DateTime.TicksPerMinute
rv.SetText("lblMin",TheMins)
rv.UpdateWidget
Timer1.Enabled = True
End Sub
Sub rv_Disabled
StopService("")
End Sub
Sub Service_Destroy
StartService("JCDIservice")
End Sub
Sub Timer1_Tick
Timer1.Enabled = False
rv_RequestUpdate
End Sub
Sub imgPers_Click
Dim MyPhone As PhoneIntents
StartActivity(MyPhone.OpenBrowser("http://jennygoesindia.blogspot.co.at"))
End Sub
Georg
Last edited by a moderator: