tags:

views:

21

answers:

1

For example code below works right

CharSequence text = TextUtils.concat( "before ", Html.fromHtml( "<b>This works</b>"), " after " );
myTextView.setText(text, TextView.BufferType.SPANNABLE );

If i put an hyperlink in the html code, i.e

CharSequence text = TextUtils.concat( "before ", Html.fromHtml( "<a href=\"www.google.it\">Google</a>"), " after " );
myTextView.setText(text, TextView.BufferType.SPANNABLE );
Linkify.addLinks( myTextView, Linkify.ALL );

"Google" is displayed but hyperlink is not undelined correctly and is not clickable. Any advice?

A: 

Remove the line Linkify.addLinks( myTextView, Linkify.ALL ); and place the following line in between your text and setText declarations:

classNameTextView.setMovementMethod(LinkMovementMethod.getInstance());

McStretch
Worked putting classNameTextView.setMovementMethod(LinkMovementMethod.getInstance());after setText :) Thanks :)
rciovati