RingtoneManager getRingtoneUri - 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 getRingtoneUri method.

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 { 
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, setType
	 
 
	public void soundPlay(int position){
		mMediaPlayer = new MediaPlayer();
		mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
		RingtoneManager mRingtoneManager = new RingtoneManager(this);
		mRingtoneManager.setType(RINGTON_STREAMTYPE);
		Uri uri = mRingtoneManager.getRingtoneUri(position);
		try { 
			mMediaPlayer.setDataSource(this, uri);
		} catch (IllegalArgumentException e) {
			// TODO 自動生成された catch ブロック 
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO 自動生成された catch ブロック 
			e.printStackTrace();
		} catch (IllegalStateException e) {
			// TODO 自動生成された catch ブロック 
			e.printStackTrace();
		} catch (IOException e) {
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 { 
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:getRingtoneUri
    } 
    public Tone cacheTone(int position) {
      mCursor.moveToPosition(position);
      Tone tone = new Tone();
      tone.name = mCursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
      tone.uri = mRingtoneManager.getRingtoneUri(position);
      return tone;
    } 
  } 
 
  class MediaToneCursor extends ToneCursor 
  { 
    public MediaToneCursor(Cursor c) { super(c); }
    public Tone cacheTone(int position) {
      mCursor.moveToPosition(position);
      Tone tone = new Tone();
      long id = mCursor.getLong(mColIdx_track_id);
      tone.uri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, id);
      String track = mCursor.getString(mColIdx_track_track);
      String name = mCursor.getString(mColIdx_track_title);
4
CodeRank

Related RingtoneManager getRingtoneUri Questions & Answers:

getRingtoneUri Method Overview
Gets a Uri for the ringtone at the given position in the Cursor.
See Code Examples for other Android RingtoneManager Methods: