B4J Question [BANano] Get type of BANanoSkeleton view

angel_

Well-Known Member
Licensed User
Longtime User
Is it possible to loop through a list and find out what kind of BANanoSkeleton view it is? something like that:

B4X:
    Dim ListObjects As List = Array As Object(SKRadio1, SKCombo2)
   
    For Each Item As Object In ListObjects
        If Item Is SKRadio Then
            Dim rbt As SKRadio = Item
            Log("is SKRadio")
        Else If Item Is SKCombo Then
            Dim cbo As SKCombo = Item
            Log("is SKCombo")
        End If
    Next
 
Solution
You must use something like this if you want to check the type of a B4J class:

B4X:
    Dim ListObjects As List = Array As Object(SKRadio1, SKCombo2)
   
    For Each Item As Object In ListObjects
        If BANano.IsClass(Item, "SKRadio") Then
            Dim rbt As SKRadio = Item
            Log("is SKRadio")
        Else If BANano.IsClass(Item, "SKCombo") Then
            Dim cbo As SKCombo = Item
            Log("is SKCombo")
        End If
    Next

Alwaysbusy

angel_

Well-Known Member
Licensed User
Longtime User
With B4XViews we have v.Tag to know what type of custom view it is, but in BANano I still haven't found something similar.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
You must use something like this if you want to check the type of a B4J class:

B4X:
    Dim ListObjects As List = Array As Object(SKRadio1, SKCombo2)
   
    For Each Item As Object In ListObjects
        If BANano.IsClass(Item, "SKRadio") Then
            Dim rbt As SKRadio = Item
            Log("is SKRadio")
        Else If BANano.IsClass(Item, "SKCombo") Then
            Dim cbo As SKCombo = Item
            Log("is SKCombo")
        End If
    Next

Alwaysbusy
 
Upvote 0
Solution
Top