Android Ringtone - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Ringtone class.

This code example shows how to use the following methods:isPlaying, stop
            ringtone.play();
        } 
    } 
 
    private void stopAnyPlayingRingtone() { 
        if (defaultRingtone != null && defaultRingtone.isPlaying()) {
            defaultRingtone.stop();
        } 
        if (ringtoneManager != null) {
            ringtoneManager.stopPreviousRingtone();
        } 
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, play, stop
		builder.setSingleChoiceItems(getEntries(), getSelectedItem(), new OnClickListener() {
			@Override 
			public void onClick(final DialogInterface dialog, final int which) {
				setSelectedItem(which);
				final Ringtone ringtone = getSelectedRingtone();
				if (ringtone.isPlaying()) {
					ringtone.stop();
				} 
				ringtone.play();
			} 
		}); 
	} 
 
	private void loadRingtones(final Context context) {
		final RingtoneManager manager = new RingtoneManager(context);
		manager.setType(RingtoneManager.TYPE_NOTIFICATION);
		final Cursor cur = manager.getCursor();
		cur.moveToFirst();
		final int count = cur.getCount();
		mRingtones = new ArrayList<Ringtone>(count);
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:play, setStreamType
        try { 
            if (mRingerPlayer != null) {
                mRingerPlayer.stop();
            } 
            mRingerPlayer = RingtoneManager.getRingtone(mContext, uri);
            mRingerPlayer.setStreamType(streamType);
            mRingerPlayer.play();
        } catch (Exception e) {
            Log.e(TAG, "error ringing", e);
        } 
    } 
 
    private synchronized void ringOutgoing(Uri uri) {
        int streamType = AudioManager.STREAM_VOICE_CALL;
        ring(uri, streamType);
    } 
 
    /* 
     * private synchronized void playNotification() { Uri notification = 
     * RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, stop
 
    public void term() 
        { 
        if (rt != null)
            { 
            if (rt.isPlaying())
                rt.stop();
            } 
 
        if (toast != null)
            toast.cancel();
        } 
 
    public void run () 
        { 
        String sText =(((lcv++ % 2) == 0)  ? "Help me!" : "I've fallen down!" );
        toast.setText(sText);
        toast.show();
        if (rt != null)
            rt.play();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, stop
        dialog.show();
        return this;
    } 
 
    private void stopAnyPlayingRingtone() { 
        if (defaultRingtone != null && defaultRingtone.isPlaying()) {
            defaultRingtone.stop();
        } 
        if (ringtoneManager != null) {
            ringtoneManager.stopPreviousRingtone();
        } 
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, play, stop
			boolean fromUser) {
	 
		if (!fromUser)
			return; 
		 
		if (mRingtone != null && !mRingtone.isPlaying())
			sampleOn(); 
 
		postVolumeChange(progress);
	} 
 
	private void postVolumeChange(int progress) {
		iLastVolume = progress;
		mHandler.removeCallbacks(null);
		mHandler.post(this);
		 
	} 
 
	@Override 
	public void onStartTrackingTouch(SeekBar seekBar) {

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, stop
		dialog.show();
		return this;
	} 
 
	private void stopAnyPlayingRingtone() { 
		if (defaultRingtone != null && defaultRingtone.isPlaying()) {
			defaultRingtone.stop();
		} 
		if (ringtoneManager != null) {
			ringtoneManager.stopPreviousRingtone();
		} 
	} 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, stop
		stop(); 
	} 
	 
	public void stop() 
	{ 
		if(r!=null&&r.isPlaying())
		r.stop();
	} 
	 
	 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, stop
 
        activationLevel = LEVEL_NOT_ACTIVE;
        message = "";
 
        if(RemoteRingActivity.ringtone != null && RemoteRingActivity.audioManager != null) {
            if(ringtone.isPlaying()) {
                ringtone.stop();
                wasStopped = true;
            } 
            audioManager.setRingerMode(oldMode);
            audioManager.setStreamVolume(AudioManager.STREAM_RING, oldVolume, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
        } 
 
        if(RemoteRingActivity.alertDialog != null)
            RemoteRingActivity.alertDialog.dismiss();
        if(RemoteRingActivity._instance != null)
            RemoteRingActivity._instance.finish();
 
        return wasStopped;
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isPlaying, stop
		if(mWakeLock.isHeld()){
			mWakeLock.release();
		} 
 
		if(mRingtone!=null){
			if(mRingtone.isPlaying()){
				mRingtone.stop();
				mRingtone=null;
			} 
		} 
 
		super.onPause(); 
	} 
 
 
 
	private synchronized void enableKeyguard() { 
		if (mKeyguardLock != null) {
			mKeyguardLock.reenableKeyguard();
			mKeyguardLock = null;
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android Ringtone Questions & Answers:

See Code Examples for Android Ringtone Methods: