Skip to content Skip to sidebar Skip to footer

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.c

Solution 1:

From API Demo,

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

Solution 2:

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.

Post a Comment for "Auto Link Property Different Text With The Actual Linking (setautolinkmask)"