如何停止 Android 中的铃声闹铃?

How to stop ringtone alarm in Android?

我为 Android 中的通知设置了闹钟。但是如何在 Android 中制作停止按钮?启动闹钟的代码:

public void playRingtone(View view) {
    try {
        Uri path = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.song);
        RingtoneManager.setActualDefaultRingtoneUri(
                getApplicationContext(), RingtoneManager.TYPE_ALARM, path
        );
        Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), path);
        r.play();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 RingtoneManager ringtoneManager = new RingtoneManager(getContext());

 public void playRingtone(View view) {
    try {
        Uri path = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.song);
        ringtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_ALARM, path);
        Ringtone r = ringtoneManager.getRingtone(getApplicationContext(), path);
        r.play();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

public void stopRingtone(){
   ringtoneManager.stopPreviousRingtone();
}