diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index 858f28747..4fec1cfc5 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -169,6 +169,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem pager.setCurrentItem(lastPosition); } + @Override protected void onStart() { super.onStart(); EventDistributor.getInstance().register(contentUpdate); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java index 1165d689a..b26d3011d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java @@ -41,6 +41,7 @@ public class PlayerWidgetJobService extends SafeJobIntentService { private PlaybackService playbackService; private final Object waitForService = new Object(); + private final Object waitUsingService = new Object(); private static final int JOB_ID = -17001; @@ -67,7 +68,11 @@ public class PlayerWidgetJobService extends SafeJobIntentService { } } - updateViews(); + synchronized (waitUsingService) { + if (playbackService != null) { + updateViews(); + } + } if (playbackService != null) { try { @@ -230,7 +235,9 @@ public class PlayerWidgetJobService extends SafeJobIntentService { @Override public void onServiceDisconnected(ComponentName name) { - playbackService = null; + synchronized (waitUsingService) { + playbackService = null; + } Log.d(TAG, "Disconnected from service"); }