public void OnSearchResult(Java.Lang.Object resultObject) { int count = 0; QuerySuggestionResponse querySuggestionResponse = (QuerySuggestionResponse)resultObject; StringBuilder resultText = new StringBuilder(); foreach (Site site in querySuggestionResponse.Sites) { string item = "[{0}] name: {1}, siteId: {2}, formatAddress: {3}, country: {4}, countryCode: {5}"; string item_str = string.Format(item, count++.ToString(), site.Name, site.SiteId, site.FormatAddress, site.Address.Country, site.Address.CountryCode); resultText.AppendLine(item_str); } resultTextView.Text = resultText.ToString(); }
public void OnSearchResult(Java.Lang.Object resultObject) { QuerySuggestionResponse querySuggestionResponse = (QuerySuggestionResponse)resultObject; IList <Site> SiteList = querySuggestionResponse.Sites; if (SiteList == null) { ResultTextView.Text = "Result is Empty!"; return; } System.Text.StringBuilder ResultText = new System.Text.StringBuilder(); ResultText.AppendLine("Success"); int count = 1; AddressDetail addressDetail; Coordinate location; Poi poi; CoordinateBounds viewport; foreach (Site site in SiteList) { addressDetail = site.Address; location = site.Location; poi = site.Poi; viewport = site.Viewport; string item = "[{0}] siteId: '{1}', name: {2}, formatAddress: {3}, country: {4}, countryCode: {5}, location: {6}, Distance: {7}, poiTypes: {8}, viewport: {9} "; ResultText.Append(string.Format(item, (count++).ToString(), site.SiteId, site.Name, site.FormatAddress, (addressDetail == null ? "" : addressDetail.Country), (addressDetail == null ? "" : addressDetail.CountryCode), (location == null ? "" : (location.Lat + "," + location.Lng)), site.Distance, (poi == null ? "" : string.Join(",", poi.PoiTypes.ToArray())), (viewport == null ? "" : "northeast{lat=" + viewport.Northeast.Lat + ", lng=" + viewport.Northeast.Lng + "}," + "southwest{lat=" + viewport.Southwest.Lat + ", lng=" + viewport.Southwest.Lng + "}\n"))); if ((poi != null)) { Gson gson = new Gson(); string jsonString = gson.ToJson(poi.GetChildrenNodes()); ResultText.Append(string.Format("childrenNode: {0} \n\n", jsonString)); } } ResultTextView.Text = ResultText.ToString(); Log.Debug(KeywordSearchActivity.TAG, "OnSuggestionSearchResult: " + ResultText.ToString()); }