Stop Alarm From Ringing In Another Activity - Android
Can someone teach me on how to stop the alarm from ringing in my code. Is what I have the right way of stopping the alarm from another activity? Because, as of now, the alarm just
Solution 1:
the Ringtone r
value that declared in the BroadcastReceiver is not the same as the one that you defined in your Activity, you have to do the something that make the r variable has more scope in your application:
you can defined the r variable as
static Ringtone;
in your broadcastreceiver and then assign value to it in onReceive() method, then to call that variable from your activity just declare new r variable as bellow:
Ringtone r=yourpackge.Your_BroadcastReceiver_Class.r
then call
r.stop();
Post a Comment for "Stop Alarm From Ringing In Another Activity - Android"