b4a Insert Timer in a code
<p>I am french so sorry for my english i do my best...</p>

<p>I try to call a sub named timer1_tick and i want it to stop my sub "b_reponse1_click". The problem is that my sub dont wait until the end of the timer...</p>

<p>Code:</p>

<pre><code>Sub Process_Globals
  Dim Timer1 As Timer
  ....
  End Sub

Sub Activity_Create(FirstTime As Boolean)
 Timer1.Initialize("Timer1", 1000) ' 1000 = 1 second
 Timer1.Enabled = True
 ...
 End Sub

Sub b_reponse1_Click
p= p + 1
If b_reponse1.Text = r5 Then
    score = score + 1
    b_reponse1.Color=Colors.Green
    CallSub("",timer1_tick)      ' Here i call sub timer1_tick 
    b_reponse1.Color=Colors.Gray
    Else
    b_reponse1.Color=Colors.Red
    b_reponse1.Color=Colors.Gray
End If

If nbqpassee = 10 Then
    Activity.RemoveAllViews
    Activity.LoadLayout("lay_main")
    Else
        CallSub("",loadq)
End If
End Sub
</code></pre>

<p>Timer1 countdown but my sub b_reponse1_Click continue execution without waiting the end of timer</p>

<p>Timer :</p>

<p>Code:</p>

<pre><code>Sub timer1_tick
 t = t + 1
 Log(t)
End Sub
</code></pre>

<p>I have try this but didn't solve my problem :</p>

<p>Code:</p>

<pre><code> Sub timer1_tick
 t = t + 1
 Log(t)
 timer1.Enabled = False
 End Sub
</code></pre>

<p>Do you know how can i do to stop my sub b_reponse1_click about to 1 second ?</p>

<p>Thanks by advance for answer !</p>