Information Technology Reference
In-Depth Information
Figure 10-1.
The initial screen of the Move Me example application
We have taken a few liberties with the starting example, having set our coordinates in
the Android emulator to a reasonably famous location: Union Square in San Francisco.
This isn't quite as contrived as it might sound. Picture yourself as a tourist in San
Francisco. You've seen the sights and sounds of the city, and find yourself in Union
Square, and want to find a train, bus, or ferry to your hotel or other destination. That's
where the rest of the functionality in our example application comes in to play.
Performing Local Transport Searches
The next two functions in our example perform the tasks of executing our chosen local
search, and processing the results.
function execSearch() {
var searchText = document.getElementById("searchtext").value;
myLocalSearch.execute(searchText);
}
The
execSearch()
function simply reads the content of the
searchtext
field on our HTML
form, seen at the top of Figure 10-1, and calls the
execute
method on our
myLocalSearch()
object with that text. We registered the
processLocalSearchResults()
method as the callback function for when
myLocalSearch()
reports a completed
execution.