码迷,mamicode.com
首页 > 移动开发 > 详细

android RingtoneManager 铃声管理器

时间:2018-09-07 10:56:17      阅读:1222      评论:0      收藏:0      [点我收藏+]

标签:man   ring   turn   tde   lis   nta   game   too   context   

 

获取默认铃声Uri/

Uri String

 
Uri sound = RingtoneManager.getDefaultUri(type);
(type = RingtoneManager.TYPE_RINGTONE or RingtoneManager.TYPE_NOTIFICATION or RingtoneManager.TYPE_ALARM
以下同)

获取铃声Uri/

Uri String

String getRingtoneUriPath(int type,int pos){
RingtoneManager manager = new RingtoneManager(mContext);
manager.setType(type);

//workaround to create mCusor inside manager, or raise a segamentation fault while invoking getRingtoneUri, below methods same too

Cursor cursor = manager.getCursor();

Uri uri = manager.getRingtoneUri(pos);
return uri==null? null:uri.toString();
}

获取铃声标题 List<String> getRingtoneTitleList(int type){ 

List<String> resArr = new ArrayList<String>();
RingtoneManager manager = new RingtoneManager(mContext);
manager.setType(type);
Cursor cursor = manager.getCursor();
if(cursor.moveToFirst()){
do{
resArr.add(cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX));
}while(cursor.moveToNext());
}
return resArr;
}

获取指定类型的

指定条目铃声操作类

Ringtone getRingtone(int type,int pos){ 

RingtoneManager manager = new RingtoneManager(mContext);
manager.setType(type);
return manager.getRingtone(pos);
}

获取指定类型所有

铃声操作列表

List<Ringtone> getRingtoneList(int type){
List<Ringtone> resArr = new ArrayList<Ringtone>();
RingtoneManager manager = new RingtoneManager(mContext);
manager.setType(type);
Cursor cursor = manager.getCursor();
int count = cursor.getCount();
for(int i = 0 ; i < count ; i ++){
resArr.add(manager.getRingtone(i));
}
return resArr;
}

android RingtoneManager 铃声管理器

标签:man   ring   turn   tde   lis   nta   game   too   context   

原文地址:https://www.cnblogs.com/reboost/p/9602484.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!