It would simplify the code. If I could do something like this.
B4X:
private sub whatever
Private xTest As B4XView = lst_xRotateKnobs.Get(i)
If xTest Is xRotateKnob Then
Public xObject As xTextField
Else If xTest Is xTextField Then
Public xObject As xRotateKnob
End If
' do stuff with the resulting xObject'
end sub
private sub whatever
Dim xTest As Object = lst_xRotateKnobs.Get(i)
If xTest Is xRotateKnob Then
Dim xObject As xRotateKnob = xTest
Else If xTest Is xTextField Then
Dim xObject As xTextField = xTest
End If
' do stuff with the resulting xObject'
end sub
No you cannot do it that way.
1. Because xRotaryKnob is not a B4XView.
2. You will get this error: 'Current declaration does not match the previous one'. You need to give it a different name.
For point1 you got a solution.
But it does not solve the second one, you need a different name.
Do you have a concrete example on what exactly you want to do ?