From 6e8d6a52c1ccf1e220d90c0b9544d0eaf48c445a Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 31 Aug 2013 13:06:42 +0400 Subject: [PATCH] routeto fix followRoute ned UI thread --- .../net/osmand/plus/osmodroid/OsMoDroidPlugin.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java b/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java index 09cb59f35b..547554a8f4 100644 --- a/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java @@ -60,15 +60,21 @@ public class OsMoDroidPlugin extends OsmandPlugin implements MonitoringInfoContr } public void reRouteTo(LatLon loc) { - OsmandApplication app = activity.getMyApplication(); - TargetPointsHelper targets = app.getTargetPointsHelper(); + final OsmandApplication app = activity.getMyApplication(); + final TargetPointsHelper targets = app.getTargetPointsHelper(); // If we are in following mode then just update target point targets.navigateToPoint(loc, true, -1); if(!app.getRoutingHelper().isFollowingMode()) { // If we are not in following mode then request new route to calculate // Use default application mode - activity.followRoute(app.getSettings().getApplicationMode(), targets.getPointToNavigate(), targets.getIntermediatePoints(), - app.getLastKnownLocation(), null); + activity.runOnUiThread(new Runnable() { + + @Override + public void run() { + activity.followRoute(app.getSettings().getApplicationMode(), targets.getPointToNavigate(), targets.getIntermediatePoints(),app.getLastKnownLocation(), null); + } + }); + } }