Android Make hyperlinks in textview clickable

こ雲淡風輕ζ 提交于 2019-12-06 13:55:45

Look at this.It may Helpfull..

  TextView tv=new TextView(this);
    tv.setLayoutParams(lparams);
    webview =new WebView(this);
    webview.setLayoutParams(lparams);
    tv.setText(Html.fromHtml("<a href='http://www.google.com'>www.google.com</a>"));
    tv.setClickable(true);
    tv.setMovementMethod(LinkMovementMethod.getInstance());
    URLSpan[] urlSpans = tv.getUrls();
    for ( URLSpan urlSpan : urlSpans )  
    {  
        webview.loadUrl( urlSpan.getURL() ); 
    }  

and look this link. http://www.indelible.org/ink/android-linkify/

Try doing it like this:

TextView articleDescription = (TextView)findViewById(R.id.articledescription);
articleDescription.setMovementMethod(LinkMovementMethod.getInstance());
articleDescription.setText(Html.fromHtml(articleInfo.getArticle_body()));

How about this,

TextView t2 = (TextView) findViewById(R.id.*example*);
t2.setMovementMethod(LinkMovementMethod.getInstance());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!