Linkify Demo

This technique should work for demos that you can't find with the previous method. If the ApiDemos application doesn't store information about the demo in res/ strings.xml, it gets its information directly from AndroidManifest.xml—and so will we.

1. After starting the ApiDemos application, find the particular demo through clicking on the menu, and remember the path you took through the menu system. In this case, you click on Text and then Linkify.

2. Open the AndroidManifest.xml file and search for the menu elements as in the previous example. But this time the menu elements must be separated by slashes instead of ".*" regular expressions. So in this case, search for the text Text/Linkify (it doesn't have to be a regular expression search).

The search should return only one result, which should be part of the the value of the android:label attribute within an activity element. That element should also contain an android:name attribute. The value of this attribute contains the path to the Activity class that implements the demo. In our example, the path is .text.Link. This translates to the Link.java file within the text subdirectory of the source tree.

So in this example, the source for the Text — Linkify menu item can be found in samples/ ApiDemos/src/com/example/android/apis/text/Linkify.java.

0 0

Post a comment