RingtoneManager stopPreviousRingtone - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for RingtoneManager stopPreviousRingtone method.

This code example shows how to use the following methods:stopPreviousRingtone
    private void stopAnyPlayingRingtone() { 
        if (defaultRingtone != null && defaultRingtone.isPlaying()) {
            defaultRingtone.stop();
        } 
        if (ringtoneManager != null) {
            ringtoneManager.stopPreviousRingtone();
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getRingtoneUri, stopPreviousRingtone
    } 
 
    @Override 
    public void onClick(DialogInterface dialog, int which) {
        boolean positiveResult = which == DialogInterface.BUTTON_POSITIVE;
        ringtoneManager.stopPreviousRingtone();
        if (positiveResult) {
            Uri uri = null;
            if (clickedPos == defaultRingtonePos) {
                uri = uriForDefaultItem;
            } else if (clickedPos == silentPos) {
                uri = null;
            } else { 
                uri = ringtoneManager
                        .getRingtoneUri(getRingtoneManagerPosition(clickedPos));
            } 
            if (listener != null) {
                listener.onRingtonePickerChanged(uri);
            } 
        } else { 
6
CodeRank
This code example shows how to use the following methods:getRingtoneUri, stopPreviousRingtone
	} 
 
	@Override 
	public void onClick(DialogInterface dialog, int which) {
		boolean positiveResult = which == DialogInterface.BUTTON_POSITIVE;
		ringtoneManager.stopPreviousRingtone();
		if (positiveResult) {
			Uri uri = null;
			if (clickedPos == defaultRingtonePos) {
				uri = uriForDefaultItem;
			} else if (clickedPos == silentPos) {
				uri = null;
			} else { 
				uri = ringtoneManager
						.getRingtoneUri(getRingtoneManagerPosition(clickedPos));
			} 
			if (listener != null) {
				listener.onRingtonePickerChanged(uri);
			} 
		} else { 
5
CodeRank
This code example shows how to use the following methods:getRingtoneUri, stopPreviousRingtone
	} 
 
	@Override 
	public void onClick(DialogInterface dialog, int which) {
		boolean positiveResult = which == DialogInterface.BUTTON_POSITIVE;
		ringtoneManager.stopPreviousRingtone();
		if (positiveResult) {
			Uri uri = null;
			if (clickedPos == defaultRingtonePos) {
				uri = uriForDefaultItem;
			} else if (clickedPos == silentPos) {
				uri = null;
			} else { 
				uri = ringtoneManager
						.getRingtoneUri(getRingtoneManagerPosition(clickedPos));
			} 
			if (listener != null) {
				listener.onRingtonePickerChanged(uri);
			} 
		} else { 
5
CodeRank
This code example shows how to use the following methods:getRingtoneUri, stopPreviousRingtone
	} 
 
	@Override 
	public void onClick(DialogInterface dialog, int which) {
		boolean positiveResult = which == DialogInterface.BUTTON_POSITIVE;
		ringtoneManager.stopPreviousRingtone();
		if (positiveResult) {
			Uri uri = null;
			if (clickedPos == defaultRingtonePos) {
				uri = uriForDefaultItem;
			} else if (clickedPos == silentPos) {
				uri = null;
			} else { 
				uri = ringtoneManager
						.getRingtoneUri(getRingtoneManagerPosition(clickedPos));
			} 
			if (listener != null) {
				listener.onRingtonePickerChanged(uri);
			} 
		} else { 
4
CodeRank
This code example shows how to use the following methods:stopPreviousRingtone
			mAccessory.disconnect();
		} catch (IOException e) {
			e.printStackTrace();
		} 
 
		mRingtoneManager.stopPreviousRingtone();
	} 
 
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true; 
	} 
 
	private BroadcastReceiver mReceiver = new BroadcastReceiver() {
 
		@Override 
		public void onReceive(Context context, Intent intent) { 
			if (intent.getAction().equals(subscription)) { 
				byte[] payload = intent.getByteArrayExtra(subscription + ".payload"); 
4
CodeRank
This code example shows how to use the following methods:stopPreviousRingtone
		ring = ringManager.getRingtone(ringtoneIndex);
		schedule(new RingtoneTask(), 0, 500);
	} 
 
	public void stop() { 
		ringManager.stopPreviousRingtone();
		cancel();
	} 
 
	private class RingtoneTask extends TimerTask {
		@Override 
		public void run() { 
			if (!ring.isPlaying() && ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getCallState() == TelephonyManager.CALL_STATE_RINGING) {
				ring.play();
			} 
		} 
	} 
} 
4
CodeRank
stopPreviousRingtone Method Overview
Stops playing the last Ringtone retrieved from this.
See Code Examples for other Android RingtoneManager Methods: