diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 0f0c1523ff..3dd0cdb6ec 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -8,6 +8,7 @@ import android.graphics.PorterDuff; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v4.content.FileProvider; @@ -535,7 +536,9 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { } private void importFavourites() { - ((FavoritesActivity) getActivity()).importFavourites(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + ((FavoritesActivity) getActivity()).importFavourites(); + } } public void shareFavorites(final FavoriteGroup group) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index d487fe6961..f2f09c3519 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -529,7 +529,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { } private void addTrack() { - ((FavoritesActivity) getActivity()).addTrack(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + ((FavoritesActivity) getActivity()).addTrack(); + } } public void showProgressBar() { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java index f58fb91504..7dbafa94be 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/FavoritesActivity.java @@ -10,6 +10,7 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.support.annotation.RequiresApi; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.widget.SearchView; @@ -83,14 +84,14 @@ public class FavoritesActivity extends TabActivity { } } - @TargetApi(Build.VERSION_CODES.KITKAT) + @RequiresApi(Build.VERSION_CODES.KITKAT) public void addTrack() { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("*/*"); startActivityForResult(intent, OPEN_GPX_DOCUMENT_REQUEST); } - @TargetApi(Build.VERSION_CODES.KITKAT) + @RequiresApi(Build.VERSION_CODES.KITKAT) public void importFavourites() { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("*/*");