當前位置: 首頁>>代碼示例>>Java>>正文


Java RingtoneManager.getRingtoneUri方法代碼示例

本文整理匯總了Java中android.media.RingtoneManager.getRingtoneUri方法的典型用法代碼示例。如果您正苦於以下問題:Java RingtoneManager.getRingtoneUri方法的具體用法?Java RingtoneManager.getRingtoneUri怎麽用?Java RingtoneManager.getRingtoneUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.media.RingtoneManager的用法示例。


在下文中一共展示了RingtoneManager.getRingtoneUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNotifications

import android.media.RingtoneManager; //導入方法依賴的package包/類
public Map<String, String> getNotifications() {
    RingtoneManager manager = new RingtoneManager(getActivity());
    manager.setType(RingtoneManager.TYPE_NOTIFICATION);
    Cursor cursor = manager.getCursor();
    Map<String, String> list = new HashMap<>();
    while (cursor.moveToNext()) {
        String notificationTitle = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
        Uri notificationUri = manager.getRingtoneUri(cursor.getPosition());
        list.put(notificationTitle, notificationUri.toString());
    }

    list.put(getString(R.string.ringtone_vk), Settings.get()
            .notifications()
            .getDefNotificationRingtone());
    return list;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:17,代碼來源:NotificationPreferencesFragment.java

示例2: searchAlarmUri

import android.media.RingtoneManager; //導入方法依賴的package包/類
private Uri searchAlarmUri(int alarmId) {
    Context context = MBApp.getApp();

    RingtoneManager ringtoneMgr = new RingtoneManager(context);
    ringtoneMgr.setType(RingtoneManager.TYPE_ALARM);
    Cursor alarms = ringtoneMgr.getCursor();
    Log.i(TAG, "playAlarm: total alarms = " + alarms.getCount());

    alarms.moveToPosition(alarmId - 4);
    Uri alarm = ringtoneMgr.getRingtoneUri(alarms.getPosition());

    if(alarm == null) {
        Log.i(TAG, "Cannot play nth Alarm. Playing default");
        alarm = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
    }

    return alarm;
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:19,代碼來源:AlertPlugin.java

示例3: startPlayingRing

import android.media.RingtoneManager; //導入方法依賴的package包/類
private void startPlayingRing() {
    RingtoneManager ringtoneManager = new RingtoneManager(this);
    ringtoneManager.setType(RingtoneManager.TYPE_ALARM);
    ringtoneManager.getCursor();

    Uri ringtoneUri = ringtoneManager.getRingtoneUri(alarm.ringPosition);
    AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
    audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 7, AudioManager.ADJUST_SAME);
    mediaPlayer = new MediaPlayer();
    try {
        mediaPlayer.setDataSource(this, ringtoneUri);
        mediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
        mediaPlayer.prepare();
        mediaPlayer.start();
        mediaPlayer.setLooping(true);

    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:segasunset,項目名稱:WeatherAlarmClock,代碼行數:21,代碼來源:BootAlarmActivity.java


注:本文中的android.media.RingtoneManager.getRingtoneUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。