diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java index 313638f195..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.execute(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) {