The example in this article describes the Android TextView method for adding hyperlinks. Share to everyone for your reference, specific as follows:
public class Link extends activity {@Override protected void onCreate (Bundle savedinstancestate) {super.oncreat
E (savedinstancestate);
Setcontentview (R.layout.link);
Text1 shows the Android:autolink property, which//automatically linkifies things like URLs and phone numbers Found in the text.
No Java code is needed to make this//work. Text2 has links specified by putting <a> tags in the string//resource. By default these links would appear but not//respond to user input.
To make them active and you are need to//call Setmovementmethod () on the TextView object.
TextView t2 = (TextView) Findviewbyid (R.ID.TEXT2);
T2.setmovementmethod (Linkmovementmethod.getinstance ()); Text3 shows creating text with links to HTML in the Java//code, rather than from a string resource. This is the for a//fixed string, using a (localizable) resource as shown above/are usually a better way to go; This example is inteNded to//illustrate I/might display text that came from A//dynamic source (eg, the network).
TextView t3 = (TextView) Findviewbyid (R.ID.TEXT3); T3.settext (html.fromhtml ("<b>text3:</b> Text with a" + "<a href=\" Http://www.googl
E.com\ ">link</a>" + "created in the Java source code using HTML");
T3.setmovementmethod (Linkmovementmethod.getinstance ()); TEXT4 illustrates constructing a styled string containing a//link without using HTML at all.
Again, for a fixed string//You should probably is using a string resource, not A//hardcoded value.
spannablestring ss = new Spannablestring ("Text4:click here to dial the phone.");
Ss.setspan (New Stylespan (Typeface.bold), 0, 6, spanned.span_exclusive_exclusive);
Ss.setspan (New Urlspan ("tel:4155551212"), N, spanned.span_exclusive_exclusive);
TextView T4 = (TextView) Findviewbyid (R.ID.TEXT4); T4.settext (ss);
T4.setmovementmethod (Linkmovementmethod.getinstance ()); }
}
For more information on Android-related content readers can view the site: "Android View tips Summary", "Android Layout Layout Skills Summary", "Android Development introduction and Advanced Course", " Android Debugging tips and FAQ Solutions Summary, Android Multimedia tips summary (audio, video, audio, etc.), "Android Basic Components Usage Summary" and "Android Control usage Summary"
I hope this article will help you with the Android program.