当前位置: 首页>>代码示例>>Java>>正文


Java RingtoneManager.getCursor方法代码示例

本文整理汇总了Java中android.media.RingtoneManager.getCursor方法的典型用法代码示例。如果您正苦于以下问题:Java RingtoneManager.getCursor方法的具体用法?Java RingtoneManager.getCursor怎么用?Java RingtoneManager.getCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.RingtoneManager的用法示例。


在下文中一共展示了RingtoneManager.getCursor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getTone

import android.media.RingtoneManager; //导入方法依赖的package包/类
/**
 * Get the tone from {@link RingtoneManager} for any given type. It will add title as the key and
 * uri of the sound as value in given hashmap.
 *
 * @param context       instance of the caller
 * @param type          type of the ringtone from {@link RingtonePickerDialog.Builder#TYPE_NOTIFICATION},
 *                      {@link RingtonePickerDialog.Builder#TYPE_RINGTONE} or {@link RingtonePickerDialog.Builder#TYPE_ALARM}
 * @param ringTonesList Hash map in which alarm tone will be added.
 */
private static void getTone(Context context,
                            int type,
                            @NonNull HashMap<String, Uri> ringTonesList) {
    RingtoneManager mRingtoneMgr = new RingtoneManager(context);

    mRingtoneMgr.setType(type);
    Cursor ringsCursor = mRingtoneMgr.getCursor();

    while (ringsCursor.moveToNext()) {
        ringTonesList.put(ringsCursor.getString(RingtoneManager.TITLE_COLUMN_INDEX),
                Uri.parse(ringsCursor.getString(RingtoneManager.URI_COLUMN_INDEX) + "/"
                        + ringsCursor.getString(RingtoneManager.ID_COLUMN_INDEX)));
    }
    ringsCursor.close();
}
 
开发者ID:kevalpatel2106,项目名称:android-ringtone-picker,代码行数:25,代码来源:RingtoneUtils.java

示例4: showRingList

import android.media.RingtoneManager; //导入方法依赖的package包/类
private List<String> showRingList(Context context) {
    List<String> ringNameList = new ArrayList<>();
    RingtoneManager ringtoneManager = new RingtoneManager(context);
    ringtoneManager.setType(RingtoneManager.TYPE_ALARM);
    Cursor cursor = ringtoneManager.getCursor();
    while (cursor.moveToNext()) {
        String ringName = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
        ringNameList.add(ringName);
    }
    return ringNameList;
}
 
开发者ID:segasunset,项目名称:WeatherAlarmClock,代码行数:12,代码来源:RingActivity.java

示例5: firstRing

import android.media.RingtoneManager; //导入方法依赖的package包/类
private String firstRing(Context context) {
    RingtoneManager ringtoneManager = new RingtoneManager(context);
    ringtoneManager.setType(RingtoneManager.TYPE_ALARM);
    Cursor cursor = ringtoneManager.getCursor();
    String ringName = null;
    while (cursor.moveToNext()) {
        ringName = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
        if (ringName != null) {
            break;
        }
    }
    cursor.close();
    return ringName;
}
 
开发者ID:segasunset,项目名称:WeatherAlarmClock,代码行数:15,代码来源:AddAlarmActivity.java

示例6: 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

示例7: firstRing

import android.media.RingtoneManager; //导入方法依赖的package包/类
private String firstRing(Context context) {
    RingtoneManager ringtoneManager = new RingtoneManager(context);
    ringtoneManager.setType(RingtoneManager.TYPE_ALARM);
    Cursor cursor = ringtoneManager.getCursor();
    String ringName = null;

    while (cursor.moveToNext()) {
        ringName = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX);
        if (ringName != null) {
            break;
        }
    }
    return ringName;
}
 
开发者ID:segasunset,项目名称:WeatherAlarmClock,代码行数:15,代码来源:MainActivity.java


注:本文中的android.media.RingtoneManager.getCursor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。