Android Question Problem into Android TV

CyclopDroid

Well-Known Member
Licensed User
Longtime User
My game runs normally on smartphones but, on TV, suddenly it ends randomly.
I have no error and no warning ... but, on TV, it continues to exit the game in different moments.
It happened to any of you? How to fix it?
 

CyclopDroid

Well-Known Member
Licensed User
Longtime User
FIND the problem :eek::eek:
The cause of the end was due to the timer which had entered into my game.
Es:
B4X:
Sub Man_Click()
If pnlMenu.Visible=True Then
       Pause(1)
       pnlMenu.Visible=False
'...
...
...
End Sub
B4X:
Private Sub Pause(Secondi As Int)
Dim Ti As Long
  Ti = DateTime.Now + (Secondi * 1000)
  Do While DateTime.Now < Ti
      DoEvents
  Loop
End Sub
 
Upvote 0

CyclopDroid

Well-Known Member
Licensed User
Longtime User
See this problem.
I'e change the Sub Pause(Secondi As Int) with a Timer_tick but the image not mouve up the screen...it's appears immediatly.


B4X:
    For k=100%y To 0%y Step -10%y
            secondi=.1
            Attendi2.Enabled=True
            imgsceriffo.Top=k
            imgfacesc.Top=k
Next


B4X:
Sub Attendi2_tick
    If millesimi>=secondi Then
        Attendi2.enabled=False
        millesimi=0
    Else
       millesimi=millesimi+.1
    End If
End Sub

Where am I wrong?
After the tick, not retuen in the For-Next loop?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
First of all you could use one of the animation libraries.

Otherwise you should use a timer and every tick decrease the value of y, using a global variable.

Another option, which Erel loves :p, is:

Activity.Invalidate : DoEvents

after imgfacesc.top = k
 
Last edited:
Upvote 0
Top