Roberto P. Well-Known Member Licensed User Longtime User Sep 27, 2014 #1 I have found that there are EditText controls, Label and Check boxes that come from the same class. So doing the following check I see that a check box is also a label! Is there a way to check precisely the type of control via code? here is a small example. Dim v As View = m_chkDisattivo If v Is Label Then Log("Label") 'OK End If If v Is EditText Then Log("text") End If If v Is CheckBox Then Log("chek") 'OK End If Thanks so much
I have found that there are EditText controls, Label and Check boxes that come from the same class. So doing the following check I see that a check box is also a label! Is there a way to check precisely the type of control via code? here is a small example. Dim v As View = m_chkDisattivo If v Is Label Then Log("Label") 'OK End If If v Is EditText Then Log("text") End If If v Is CheckBox Then Log("chek") 'OK End If Thanks so much
Erel B4X founder Staff member Licensed User Longtime User Sep 28, 2014 #2 You can use GetType to get the java type. However a better solution is to change the order of tests: B4X: Dim v As View = m_chkDisattivo If v Is EditText Then ... Else If v Is CheckBox Then Else If v Is Label Then End If Upvote 0
You can use GetType to get the java type. However a better solution is to change the order of tests: B4X: Dim v As View = m_chkDisattivo If v Is EditText Then ... Else If v Is CheckBox Then Else If v Is Label Then End If
Roberto P. Well-Known Member Licensed User Longtime User Sep 28, 2014 #3 hello Erel, I thank you for your reply. you can tell me where can I find an example to do the check with Java. regards Upvote 0
hello Erel, I thank you for your reply. you can tell me where can I find an example to do the check with Java. regards
Erel B4X founder Staff member Licensed User Longtime User Sep 28, 2014 #4 Call GetType(v) and check the string returned. Upvote 0