Show a hyperlink in a label

moster67

Expert
Licensed User
Longtime User
We can open a web-page using:

B4X:
Dim p As PhoneIntents
    StartActivity(p.OpenBrowser("http://www.b4x.com"))

Most of the times, that's enough for my purposes.

However, I am wondering if it is possible to show a clicckable link in a label? I have tried but the link is recognized as ordinary text. I have seen links in other applications so I guess it's possible but probably that's a property/method of the label which is not supported yet. Could this be added in a future release?
 

agraham

Expert
Licensed User
Longtime User
In a couple of days time :)

B4X:
   Dim Obj1 As Reflector
   Label1.Text = "Link to http://www.b4x.com"
   Obj1.Target = Obj1.CreateObject("android.text.util.Linkify")
   Dim args(2) As Object
   Dim types(2) As String   
   args(0) = Label1
   types(0) = "android.widget.TextView"
   args(1) = 15
   types(1) = "java.lang.int"   
   Obj1.RunMethod4("addLinks", args, types)
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
I got error when compile your code. Did you use new or your own library?

Error description: Unknown type: reflector
Are you missing a library reference?
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
:BangHead: I can't !!!

:sign0060:
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Agraham,

it works a treat with your reflection-library! Really appreciated.

:sign0098:

Thanks.
 
Last edited:
Upvote 0
Top