0

I have a lot of text, and I want to make a link in the middle of that.

This is how it looks like, and the www.rkz.nl is what i want to be a link.

enter image description here

4 Answers4

0

Add following property to textview

android:autoLink="web"
mdDroid
  • 3,135
  • 2
  • 22
  • 34
0

make that text in the string file and then connect the string with the link you want

Neelay Srivastava
  • 100
  • 1
  • 2
  • 17
  • That's the point, I already have all the text in the string file, just want to know how i can get that part in to a link. How do i connect it –  Apr 25 '16 at 13:33
0

Using Xml

<TextView
android:text="Click my My Url: www.google.com"
android:id="@+id/tvUrl"
android:layout_height="wrap_content" 
android:layout_width="wrap_content"
android:autoLink="web">

programmatically

 final TextView tvUrl= (TextView)findViewById(R.id.tvUrl);
    tvUrl.setText("Click my My Url: www.google.com");
    Linkify.addLinks(tvUrl, Linkify.WEB_URLS);
Vanraj Ghed
  • 1,261
  • 11
  • 23
0

found a similar question try this Dynamically setting links to text in strings.xml or try this

TextView textView =(TextView)findViewById(R.id.textView);
textView.setClickable(true);
textView.setMovementMethod(LinkMovementMethod.getInstance());
String text = "<a href='http://www.google.com'> Google </a>";
textView.setText(Html.fromHtml(text));

here google will be displayed as a link

Community
  • 1
  • 1
Neelay Srivastava
  • 100
  • 1
  • 2
  • 17