Android Question How do you stop the first condition?

Mikota

New Member
As you can see in the picture, I put two button when the button sos is active, state is equal to 1 , and when I press the power button, the first condition is established, and when press the power button again , I want to make a second condition. The first condition is immediately discontinued. Is this clear?

https://pasteboard.co/HBzxtJb.png


B4X:
If FlashMode.ToUpperCase = "OFF" Then
            Do While(state = 1)
                btn.Background = bmp1
                For i1 = 0 To 2
                    flash.FlashOn
                    Sleep(2000)
                    flash.FlashOff
                    Sleep(500)
                Next
                For i2 = 0 To 2
                    flash.FlashOn
                    Sleep(500)
                    flash.FlashOff
                    Sleep(500)
                Next
                Sleep(1000)
            Loop
        Else
            flash.FlashOff
            btn.Background = bmp2
        End If
 
Last edited:

OliverA

Expert
Licensed User
Is this clear?
Maybe.
B4X:
If FlashMode.ToUpperCase = "OFF" Then
            Do While(state = 1)
                btn.Background = bmp1
                If pushed = 1 Then 'pushed variable incremented for each power button push. If pushed first time, do the below
                   For i1 = 0 To 2
                     flash.FlashOn
                     Sleep(2000)
                     If pushed <> 1 Then Exit ' you wanted immediate, so let's quit in the middle too if something changes
                     flash.FlashOff
                     Sleep(500)
                   Next
               Else ' pushed is > 1
                For i2 = 0 To 2
                    flash.FlashOn
                    Sleep(500)
                    If pushed <> 2 Then Exit
                    flash.FlashOff
                    Sleep(500)
                Next
              End If
                Sleep(1000)
            Loop
        Else
            flash.FlashOff
            btn.Background = bmp2
        End If
 

Mikota

New Member
That's not exactly what I wanted, but it helped me with little change .However ,Thank you so much buddy
 
Top