Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从android中的RingtoneManager获取铃声列表?_Android_List_Ringtone_Items - Fatal编程技术网

如何从android中的RingtoneManager获取铃声列表?

如何从android中的RingtoneManager获取铃声列表?,android,list,ringtone,items,Android,List,Ringtone,Items,我想实现一个从RingtoneManager获取列表中所有铃声名称的应用程序。我已经实现了我的应用程序,用于获取设备中可用的所有铃声,如下所示: Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); startActivity(intent); 启动应用程序时,我会看到一个对话框。在该对话框中,我在列表视图中设置了一组带有单选按钮的铃声。我想将该列表中的所有项目打印到我的应用程序中 如何打印默认铃声

我想实现一个从RingtoneManager获取列表中所有铃声名称的应用程序。我已经实现了我的应用程序,用于获取设备中可用的所有铃声,如下所示:

   Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    startActivity(intent);
启动应用程序时,我会看到一个对话框。在该对话框中,我在列表视图中设置了一组带有单选按钮的铃声。我想将该列表中的所有项目打印到我的应用程序中


如何打印默认铃声管理器列表视图中的所有项目?

您是否尝试了
RingtoneManager
getCursor()
方法

根据:

返回所有可用铃声的光标。每次调用此方法时返回的游标都是相同的游标,因此不要关闭()游标。可以安全地停用光标()。 如果未使用RingtoneManager(Activity),调用方应在其Activity的生命周期内管理返回的游标,以防止游标泄漏。

您可以这样做

    RingtoneManager ringtoneManager = new RingtoneManager(yourActivity);
    ringtoneManager.setType(RingtoneManager.TYPE_RINGTONE);
    Cursor cursor = ringtoneManager.getCursor();
    while (cursor.moveToNext()) {
     System.out.println(cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX));
     System.out.println(cursor.getString(RingtoneManager.URI_COLUMN_INDEX));
    }
    RingtoneManager ringtoneManager = new RingtoneManager(yourActivity);
    ringtoneManager.setType(RingtoneManager.TYPE_RINGTONE);
    Cursor cursor = ringtoneManager.getCursor();
    while (cursor.moveToNext()) {
     System.out.println(cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX));
     System.out.println(cursor.getString(RingtoneManager.URI_COLUMN_INDEX));
    }