Search code examples
androidandroid-edittextlinkify

How can I make links in an EditText clickable?


I have an EditText on Android I'd for which I'd like any embedded urls to be clickable. I used the Linkify class, which has turned them blue and underlined them. However, I can't figure out how to actually make them clickable.

Thanks!


Solution

  • XML:

     android:linksClickable="true"
     android:autoLink="web|email"
    

    JAVA:

    TextView textView = (TextView) findViewById(R.id.textViewId);
    textView.setText(Html.fromHtml(html));
    textView.setMovementMethod(LinkMovementMethod.getInstance());