From 8b728fba7e4e6c88c13940854f45b4917a0ec0e0 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 13 Jul 2017 12:14:42 +0300 Subject: [PATCH 1/2] Fix #3759 --- OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java index 313638f195..7017b48d5a 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java @@ -79,7 +79,7 @@ public abstract class OsmandMapLayer { public void executeTaskInBackground(AsyncTask task, Params... params) { - task.execute(params); + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } public boolean isPresentInFullObjects(LatLon latLon) { From 763aac161547435b1eff83f859911011bc56d568 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 13 Jul 2017 12:47:06 +0300 Subject: [PATCH 2/2] Add version check --- OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java index 7017b48d5a..0c2592cd07 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java @@ -12,6 +12,7 @@ import android.graphics.PointF; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffColorFilter; import android.os.AsyncTask; +import android.os.Build; import android.support.annotation.NonNull; import android.view.MotionEvent; @@ -76,10 +77,14 @@ public abstract class OsmandMapLayer { public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) { return false; } - + public void executeTaskInBackground(AsyncTask task, Params... params) { - task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); + } else { + task.execute(params); + } } public boolean isPresentInFullObjects(LatLon latLon) {