I have a button that changes the SetScreenOrientation(0) as well as loads exoplayer. The first time I press the button Activity_Create is triggered and causes the layout to change. This causes the Exoplayer panel not to be loaded.
The second time I hit the button it does not trigger the Activity_Create. Which works perfectly.
I have tried adding an if statement to watch for a value that is set when the button is clicked to force the right panel to be loaded but it is acting like the value was never set????
The second time I hit the button it does not trigger the Activity_Create. Which works perfectly.
I have tried adding an if statement to watch for a value that is set when the button is clicked to force the right panel to be loaded but it is acting like the value was never set????
B4X:
Sub Button4_Click
vidon = "1"
LoadLayoutToPanel("1")
If 1==1 Then
player1.Initialize("player")
sources.Initialize
sources.Add(player1.CreateFileSource(File.DirRootExternal & "/Download","big.mp4"))
player1.Prepare(player1.CreateListSource(sources))
' SimpleExoPlayerView1.
End If
SimpleExoPlayerView1.Player = player1
End Sub
B4X:
Sub LoadLayoutToPanel (Layout As String)
If Panel1.IsInitialized Then
Activity.RemoveViewAt(0)
End If
Panel1.Initialize("")
Panel1.LoadLayout(Layout)
Activity.AddView(Panel1, 0, 0, 100%x, 90%y)
If Layout == "1" Then
p.SetScreenOrientation(0)
End If
End Sub
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
If vidon == 1 Then
If sources.Size - 1 >= 0 Then
LoadLayoutToPanel("1") ' Video panel
End If
Else
If List0.IsInitialized == False Then
LoadLayoutToPanel("selector")
Else
LoadLayoutToPanel("mainpage")
Button2_Click
End If
End If
Last edited: