Android Question BBCodeView - long press or tap on the word


Active Member
Licensed User
I have used the BBCodeView as the alternative for the EditText.
Please can I use long press or tap on the word in plain text?
I need to use long tap on the word in plain text on BBCodeView and after the word is writen on the label or EditText.

If yes please how can I do it?


B4X founder
Staff member
Licensed User
Longtime User
Out of the box you can use the LinkClicked events with URL tags.

You can use this code to find the clicked work:
1. Add this after you set the text:
Dim TouchPanel As B4XView = xui.CreatePanel("TouchPanel")
Dim fv As B4XView = BBCodeView1.ForegroundImageView, fv.Left, fv.Top, fv.Width, fv.Height)

2. Handle the event:
Sub TouchPanel_Touch (Action As Int, X As Float, Y As Float)
   If Action = Then
       Dim single As BCSingleStyleSection = TextEngine.FindSingleStyleSection(BBCodeView1.Paragraph, X, Y)
       If single <> Null Then
           Activity.Title = single.ParentUN.Text
       End If
   End If
End Sub
Upvote 0