From 88b5c7442a0cd5e7d69df6dcb0a147f418c716de Mon Sep 17 00:00:00 2001 From: sanderd17 Date: Sun, 3 Jun 2012 16:14:52 +0300 Subject: [PATCH] Better parsing of query string for geo intent --- .../activities/search/GeoIntentActivity.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index 7a57b8a890..2e1d3d7c68 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -196,11 +196,17 @@ public class GeoIntentActivity extends OsmandListActivity { private List elements; public GeoAddressSearch(String query) { - StringTokenizer s = new StringTokenizer(query.substring(query - .indexOf("q=") + 2), ","); - elements = new ArrayList(s.countTokens()); - while (s.hasMoreTokens()) { - elements.add(s.nextToken().replace('+', ' ').trim()); + query = query.replaceAll("%20", ",").replaceAll("%0A",",") + .replaceAll("\n",",").replaceAll("\t",",") + .replaceAll(" ", ","); + System.out.println(query); + //String is split on each comma + String[] s = query.substring(query + .indexOf("q=") + 2).split(","); + + elements = new ArrayList(); + for (int i = 0; i