Android Question [Solved] Object GetType

ALBRECHT

Active Member
Licensed User
Hello,

I have that sub to try to make some actions regarding of the view object type :

B4X:
Sub TrtObject(Obj As Object)
    Dim Lbl As Label
    Dim Btn As Button
    Dim Lv As ListView
    Dim Clv As CustomListView   
    
    Log(GetType(Obj))
    
    If GetType(Obj) = "Label" Then
        Lbl = Obj
        'Label process ...
    End If
    
    If GetType(Obj) = "ListView" Then
        Lv = Obj
        'Lv process ...
    End If

End Sub

but for the Label type, GetType return : android.widget.TextView

and for ListView type : anywheresoftware.b4a.objects.ListViewWrapper$SimpleListView

Please, do you have the good method to return : Label and ListView ?

Thank you
Michel
 
Top