Posts

Showing posts with the label Clickable links in TextView

Add Clickable links to TextView in Sketchware

Image
Here are two ways of adding clickable links to TextView in Sketchware. Method 1 1. In main.xml add a TextView text_html . 2. Create a String html_string . 3. In onCreate event: a. Set the text of  html_string  to your text in html form with links declared in <a> tag ( <a href="http://google.com"> Google </a> will display 'Google' in link form). So let's set String  html_string  to: <b>text_html_program: Explicit links using &lt;a&gt; markup.</b> This has markup for a <a href="http://www.google.com">link</a> specified via an &lt;a&gt; tag. Use a "tel:" URL to <a href="tel:4155551212">dial a phone number</a>. b. Display this String in TextView. In an add source directly block put following codes: text_html.setText( Html.fromHtml(html_string)); text_html.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); Method 2 1. In  m...