Android 在Exoplayer通知中单击暂停按钮时停止动画

Android 在Exoplayer通知中单击暂停按钮时停止动画,android,animation,notifications,imagebutton,exoplayer,Android,Animation,Notifications,Imagebutton,Exoplayer,我的问题是,我在我的应用程序中添加了一个Exoplayer通知,我想在按下“暂停”按钮时,停止MainActivity中的动画。我有一个图像按钮的动画。我知道在正常情况下如何停止动画, 但我不知道如何停止动画的通知。下面我将为您添加我的通知代码。 提前谢谢你 notificationManager = PlayerNotificationManager.createWithNotificationChannel( this, CHANNEL_ID,

我的问题是,我在我的应用程序中添加了一个Exoplayer通知,我想在按下“暂停”按钮时,停止MainActivity中的动画。我有一个图像按钮的动画。我知道在正常情况下如何停止动画, 但我不知道如何停止动画的通知。下面我将为您添加我的通知代码。 提前谢谢你

notificationManager = PlayerNotificationManager.createWithNotificationChannel(
            this,
            CHANNEL_ID,
            R.string.exo_download_notification_channel_name,
            NOTIFICATION_ID,
            new PlayerNotificationManager.MediaDescriptionAdapter() {
                @Override
                public String getCurrentContentTitle(Player player) {
                    return text_song;
                }

                @Nullable
                @Override
                public PendingIntent createCurrentContentIntent(Player player) {
                    Intent intent = new Intent(MainActivity.this, MainActivity.class);
                    PendingIntent contentPendingIntent = PendingIntent.getActivity
                            (MainActivity.this, 0, intent, 0);
                    return contentPendingIntent;
                }
                @Nullable
                @Override
                public String getCurrentContentText(Player player) {
                    return null; 
                }

                @Nullable
                @Override
                public Bitmap getCurrentLargeIcon(Player player, PlayerNotificationManager.BitmapCallback callback) {

                    return null;
                }
            }
    );
    notificationManager.setUseChronometer(true);
    notificationManager.setUseNavigationActions(false);
    notificationManager.setFastForwardIncrementMs(0);
    notificationManager.setRewindIncrementMs(0);
    notificationManager.setPriority(NotificationCompat.PRIORITY_HIGH);
    notificationManager.setPlayer(player);

你也在使用mediasession吗?我的应用程序中有一个只有音频的Exoplayer。如果你是这个意思…你已经有了播放控件的通知吗?是的,没错…你可以使用广播接收器或绑定你的服务与活动进行通信。