Android Programming Tutorials

(Romina) #1

TUTORIAL 31


Searching For Food


In this tutorial, we will enable searching of the restaurant list, so you can


find one in the vast array of restaurants you surely will maintain in this


application.


Step-By-Step Instructions.........................................................................


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


starting 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


14-Rotation edition of LunchList to use as a starting point.


Step #1: Have the List Conduct the Search......................................


First, we need to be able to trigger the local search. To do this, add another


item to our LunchList/res/menu/options.xml menu definition:


<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/add"
android:title="Add"
android:icon="@drawable/ic_menu_add"
/>
<item android:id="@+id/search"
android:title="Search"
android:icon="@drawable/ic_menu_search"
/>
<item android:id="@+id/prefs"

299
Free download pdf