<string name="msg_sbc_failed">Sorry, the search encountered a problem.</string>
<string name="msg_sbc_no_page_returned">No page returned</string>
<string name="msg_sbc_page">Page</string>
- <string name="msg_sbc_snippet_unavailable">Snippets not available</string>
+ <string name="msg_sbc_snippet_unavailable">Snippet not available</string>
<string name="msg_sbc_unknown_page">Unknown page</string>
<string name="msg_searching_book">Searching book\u2026</string>
<string name="msg_share_barcode">Here\'s the contents of a barcode I scanned</string>
addressResult.getTitle());
break;
case 1:
- searchMap(addressResult.getAddress());
+ String[] names = addressResult.getNames();
+ String title = names != null ? names[0] : null;
+ searchMap(addressResult.getAddress(), title);
break;
case 2:
dialPhone(addressResult.getPhoneNumbers()[0]);
launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(geoURI)));
}
- public void searchMap(String address) {
- launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(address))));
+ /**
+ * Do a geo search using the address as the query.
+ *
+ * @param address The address to find
+ * @param title An optional title, e.g. the name of the business at this address
+ */
+ public void searchMap(String address, String title) {
+ String query = address;
+ if (title != null && title.length() > 0) {
+ query = query + " (" + title + ")";
+ }
+ launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(query))));
}
public void getDirections(float latitude, float longitude) {
}
}
+ // TODO: The current Contacts Intent API can only accept one value for each field, so we pick the
+ // first element in the array for names, phone numbers, and emails. It would be great to fix this.
private static void putExtra(Intent intent, String key, String[] value) {
if (value != null && value.length > 0) {
putExtra(intent, key, value[0]);