Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Dim tmrNotification As Timer
'play notification sound
Dim soundPool1 As SoundPool 'lib: audio
Dim soundPoolLoadId As Int=0
Private CustomListView1 As CustomListView
Dim csb As CSBuilder
Dim Dialog As B4XDialog
End Sub
Public Sub Initialize
B4XPages.GetManager.LogEvents = True
tmrNotification.Initialize("tmrNotification",10000)
soundPool1.Initialize(2)
soundPoolLoadId=soundPool1.Load(File.DirAssets, "notificationsound.wav")
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dialog.Initialize(Root)
tmrNotification.Enabled=True
Dim rs As ResumableSub =getDrawOverOtherAppsPermission
Wait For (rs) complete(intResult As Int)
displayxCLV
End Sub
Sub displayxCLV
CustomListView1.AddTextItem($"app starts ${DateTime.Time(DateTime.Now)}"$, DateTime.Time(DateTime.Now))
End Sub
Sub tmrNotification_Tick
Log("entering timer_tick")
If Rnd(0,9)>5 Then
'play sound file
Log("playing sound")
soundPool1.Play(soundPoolLoadId, 1, 1, 1 , 0, 1)
displayxCLV
End If
End Sub
Private Sub CustomListView1_ItemClick (Index As Int, Value As Object)
Log(Value)
End Sub