I currently start a Ringtone on Android and it plays fine.

However when I try to stop the ringtone it doesn't stop or atleast
doesn't stop straight away, it will keep in playing until it just
plays out.

Here is how I set up the Ringtone:

int rm = audio_service.getRingerMode();
int vs =
audio_service.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);

android.os.Vibrator v = (Vibrator)
getSystemService(Context.VIBRATOR_SERVICE);

if ((rm == AudioManager.RINGER_MODE_VIBRATE ||
    (rm == AudioManager.RINGER_MODE_NORMAL && vs ==
AudioManager.VIBRATE_SETTING_ON)))
            v.vibrate(vibratePattern,1);

if (audio_service.getStreamVolume(AudioManager.STREAM_RING) > 0)
{

    oRingtone = RingtoneManager.getRingtone(this,
Settings.System.DEFAULT_RINGTONE_URI);
    oRingtone.setStreamType(AudioManager.STREAM_RING);
    oRingtone.play();

    }

And here is how I try to stop it

if (CallDialogActivity.oRingtone != null) {
      Log.d("RINGTONE", "Into Ringtone if");
      Ringtone ringtone = CallDialogActivity.oRingtone;
      oRingtone = null;
      ringtone.stop();
}

Has anyone come across similiar problems or see any mistakes in my
code?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to