Android Programming Tutorials

(Romina) #1

TUTORIAL 24


Browsing Some Posts


In this tutorial, we will support clicking on links found in status updates,


popping those up in the Browser application. We will also add a help screen


that loads a local help HTML file, by integrating WebKit into Patchy.


Step-By-Step Instructions


First, you need to have completed the previous tutorial. If you are


beginning the tutorials here, or if you wish to not use your existing work,


you can download a ZIP file with all of the tutorial results, and you can copy


the 23-Media edition of Patchy to use as a starting point.


Step #1: Add Auto-Linking


We can start by letting Android "do the heavy lifting for us" in making links


in status updates click-able. That is merely a matter of adding


android:autoLink = "all" to the TextView for the status text in


Patchy/res/layout/row.xml. With a value of "all", we are saying that we


want all recognized patterns to be converted to links: Web URLs, email


addresses, phone numbers, etc.


If you make this change, then recompile and reinstall the application, you


will notice two things:


251
Free download pdf