Get lat/long pair from street address

Pass a street address and get a geocoded lat/lon back.

Before you can do this, you need a TGMap . Here's how to get one.

LatLng centerScreen = tgMap.getScreenCenterLatLng();
LatLngBounds screenBounds = tgMap.getScreenBounds(); // Get bounds from map
TGSearchRequest request = new TGSearchRequest(searchText, centerScreen)
    .setSearchBounds(screenBounds);

TGSearchEndpoint.TGSearchCallback callback = new TGSearchEndpoint.TGSearchCallback() {
   @Override
   public void onSuccess(TGSearchResponse tgSearchResponse) {
      List<TGSearchResult> results = tgSearchResponse.getResults();
      if (results.isEmpty()) {
         // Handle failure
         return;
      }
      // Use the first result as it is likely the best (or filter based on your needs)
      LatLng latLng = results.get(0).getLocation();
   }

   @Override
   public void onFailure(Exception e) {
      // Handle failure
   }
};

TallyGo.getTGSearch().search(request, callback);
Check out the Android Reference App to see this example in action.