From a70d36bb806a73958dab48dfd46f60af2e34fba2 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 17 Jul 2018 16:21:02 +0200 Subject: [PATCH] Fix another crash with ringtone Signed-off-by: Mario Danic --- .../talk/controllers/RingtoneSelectionController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.java b/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.java index cbfae4a2c..7e7144275 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/RingtoneSelectionController.java @@ -229,7 +229,6 @@ public class RingtoneSelectionController extends BaseController implements Flexi NotificationSoundItem notificationSoundItem = (NotificationSoundItem) adapter.getItem(position); Uri ringtoneUri = null; - Runnable runnable = () -> endMediaPlayer(); if (!TextUtils.isEmpty(notificationSoundItem.getNotificationSoundUri())) { ringtoneUri = Uri.parse(notificationSoundItem.getNotificationSoundUri()); @@ -238,7 +237,12 @@ public class RingtoneSelectionController extends BaseController implements Flexi mediaPlayer = MediaPlayer.create(getActivity(), ringtoneUri); cancelMediaPlayerHandler = new Handler(); - cancelMediaPlayerHandler.postDelayed(runnable, mediaPlayer.getDuration() + 25); + cancelMediaPlayerHandler.postDelayed(new Runnable() { + @Override + public void run() { + endMediaPlayer(); + } + }, mediaPlayer.getDuration() + 25); mediaPlayer.start(); }