Timer = Crash

Cynikal

Member
Licensed User
Longtime User
I might be doing something wrong here... but....


Under globals: Dim tmr_progbar As Timer


then i got...

Sub btn_Login_Click
prog_Loading.Visible = True
tmr_progbar.Interval = 500
'prog_Loading.Indeterminate = True
prog_Loading.Progress = 1
tmr_progbar.Enabled = True
End Sub

Sub tmr_progbar_Tick
'If prog_Loading.Progress < 100 Then
'prog_loading.Progress = prog_loading.Progress + 1
'Else
'tmr_progbar.Enabled = False
'End If
End Sub


this is to simulate the progressbar loading... now..if you notice..i have the text in the progbar timer...commented.


When I run it on my phone, i click the login button...my phone will vibrate...pause...vibrate... "blah blah blah unexpectedly quit".


I am using a Samsung Galaxy S (Mesmerize(US Cellular)) I500
 

splatt

Active Member
Licensed User
Longtime User
I don't see you initializing the timer anywhere?

B4X:
Timer1.Initialize("Timer1", 1000)
Timer1.Enabled = True

Also

Timers should be declared in Sub Process_Globals. Otherwise you may get multiple timers running when the activity is recreated.

from B4A Help Viewer(Core)
 

Cynikal

Member
Licensed User
Longtime User
I actually have it now set to Sub Process_Globals


and then...


Sub btn_Login_Click
prog_Loading.Visible = True
tmr_progbar.Interval = 1000
'prog_Loading.Indeterminate = True
prog_Loading.Progress = 1
tmr_progbar.Initialize("tmr_progbar", 1000)
tmr_progbar.Enabled = True
End Sub
 

Cynikal

Member
Licensed User
Longtime User
I think I figured it out.

Once I removed the: tmr_progbar.Interval = 1000 before the initialize... it started to work.
 
Top