Android Question Message to the compiler?

Jerryk

Active Member
Licensed User
Longtime User
I am creating my own custom view. Since my logic is based on Tags, I need to check for the uniqueness of the tag value.
View has a function AddLabel (pTag as String, ....).
I need to prevent using the same Tag when calling:
xxxxx.AddLabel("tag1",...) repeatedly.
I can detect the duplicate in the GetAllViewsRecursive loop, but how do I pass it to the compiler? Passing it via message seems unsystematic to me. Or another solution?
 
Please post some example or code snippet. I don't fully understand, why you try to pass something to the compiler.
 
Upvote 0
I need to prevent using the same Tag when calling:
xxxxx.AddLabel("tag1",...) repeatedly.
Add a private map or list to your Customview.
Check this map or list when using AddLabel. Return an error if the tag is already available in the map/list.
 
Last edited:
Upvote 0
YES! I used Throwables library:
B4X: Copy
Private Sub CheckDuplication (pTag As String)
    If lTags.IndexOf(pTag) <> -1 Then 'check if tag exist in list
        Dim TH As Throwables
        TH.Initialize
        TH.Throw(Throwables_Static.NewIllegalArgumentException("Duplicate tag: " & pTag))
    End If
End Sub
 
Upvote 0
Back
Top