Bug? B4i v2.0, Find VideoView with Page1.RootPanel.GetAllViewsRecursive

Pendrush

Well-Known Member
Licensed User
Longtime User
If v Is VideoView is always false.


B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page

    Private VideoV As VideoView
    Private btnFindView As Button

   
End Sub

Private Sub Application_Start (Nav As NavigationController)
   
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.Color = Colors.White
    'NavControl.ShowPage(Page1)
   
           
    VideoV.Initialize("VideoV")
    btnFindView.Initialize("btnFindView", btnFindView.STYLE_SYSTEM)

    Page1.RootPanel.AddView(btnFindView, 0, 0, 100, 50)
    Page1.RootPanel.AddView(VideoV.View, 0, 0, 100%x, 100%y)
   
    btnFindView.Text = "Find VV"
    btnFindView.Color = Colors.LightGray
   
    VideoV.ShowControls = False
               
    NavControl.ShowPage(Page1)
   
    CallSubDelayed(Me, "PlayVideo")
   
   
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
   
    VideoV.View.Height = Height
    VideoV.View.Width = Width
   
    btnFindView.Top = Height - btnFindView.Height
    btnFindView.Left = Width - btnFindView.Width
   
    btnFindView.BringToFront
       
End Sub

Private Sub Application_Background
   
End Sub

Public Sub PlayVideo
   
    VideoV.Stop
    VideoV.LoadVideoUrl("https://devimages.apple.com.edgekey.net/iphone/samples/bipbop/bipbopall.m3u8")
   
End Sub


Private Sub VideoV_Ready
   
    VideoV.Play
   
End Sub


Private Sub btnFindView_Click
   
    For Each v As View In Page1.RootPanel.GetAllViewsRecursive
   
        If v Is VideoView Then
            Log("Found: " & v) '< This line is not executed
        End If
        'Log (v)
    Next
   
End Sub


As a workaround I use panel and add VideoView in panel, then remove all views from panel, that is only way to remove VideoView from page.
 
Top