Auto link property different text with the actual linking (setAutoLinkMask)

For example

TextView tv =(TextView)this.findViewById(R.id.tv);
tv.setAutoLinkMask(Linkify.ALL);
tv.setText("visit website, http://www.google.com");

pressing on http://www.google.com will take me to http://www.google.com. The thing I want to do is like this

TextView tv =(TextView)this.findViewById(R.id.tv);
tv.setAutoLinkMask(Linkify.ALL);
tv.setText("visit this website");

and pressing on "this" I want to take me to http://www.google.com.

How can I do this ? (is it possible at all ?)

Answers


From API Demo,

TextView t3 = (TextView) findViewById(R.id.text3);
t3.setText(Html.fromHtml(
                    "<b>text3:</b>  Text with a " +
                    "<a href=\"http://www.google.com\">link</a> " +
                    "created in the Java source code using HTML."));
t3.setMovementMethod(LinkMovementMethod.getInstance());

You can just use the attribute android:text="@string/url" as the TextView attribute. Make sure to put a valid URL as the value of the TextView.


Need Your Help

Python YAML Integer Attributes

python yaml

My yaml file as the following data

Latitude/Longitude Qt4 widget?

qt qt4 pyqt pyqt4

What is the best starting point for a Qt4 widget for entering Latitude/Longitude in DD:MM:SS format (degrees, minutes, seconds)? Customize a QLineEdit? A series of spin boxes?