为指定联系人设定指定铃声
来源:互联网 发布:怎样卸载苹果软件 编辑:程序博客网 时间:2024/05/16 19:32
针对android4.1代码有效
public void onRingtoneChanged(TextView btnRingtoneContent,boolean isOnclick) {
// TODO Auto-generated method stubmBtnRingtone = btnRingtoneContent;
if(isOnclick){
doPickRingtone();
}
}
private void doPickRingtone() {
Log.v("sjb","doPickRingtone.....");
Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
// Allow user to pick 'Default'
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
// Show only ringtones
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_RINGTONE);
// Don't show 'Silent'
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
Uri ringtoneUri;
if (mCustomRingtone != null) {
ringtoneUri = Uri.parse(mCustomRingtone);
} else {
// Otherwise pick default ringtone Uri so that something is selected.
ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
}
// Put checkmark next to the current ringtone for this contact
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, ringtoneUri);
// Launch!
startActivityForResult(intent, REQUEST_CODE_PICK_RINGTONE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (mStatus == Status.SUB_ACTIVITY) {
mStatus = Status.EDITING;
}
// See if the photo selection handler handles this result.
if (mCurrentPhotoHandler != null && mCurrentPhotoHandler.handlePhotoActivityResult(
requestCode, resultCode, data)) {
return;
}
switch (requestCode) {
case REQUEST_CODE_PICK_RINGTONE: {
Uri pickedUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
handleRingtonePicked(pickedUri);
break;
}
// The following lines are provided and maintained by Mediatek
// Inc.
}
}
private void handleRingtonePicked(Uri pickedUri) {
if (pickedUri == null || RingtoneManager.isDefault(pickedUri)) {
mCustomRingtone = null;
} else {
mCustomRingtone = pickedUri.toString();
}
Uri ringtoneContactUri = mLookupUri;
//if (mContactData != null) {
// ringtoneContactUri = mContactData.getLookupUri();
//}
Intent intent = ContactSaveService.createSetRingtone(
mContext, ringtoneContactUri, mCustomRingtone);
mContext.startService(intent);
updateView();
}
private void updateView() {
if (mCustomRingtone == null) {
if(mBtnRingtone != null)
mBtnRingtone.setText(getString(R.string.default_ringtone));
} else {
Uri ringtoneUri = Uri.parse(mCustomRingtone);
Ringtone ringtone = RingtoneManager.getRingtone(mContext, ringtoneUri);
if (ringtone == null) {
Log.w(TAG, "ringtone's URI doesn't resolve to a Ringtone");
return;
}
mBtnRingtone.setText(ringtone.getTitle(mContext));
}
}
- 为指定联系人设定指定铃声
- Android将SD卡的音乐文件设置为指定联系人的来电铃声
- iOS设定指定文字颜色为红色
- 如何打开电话本选定联系人-设定其来电铃声
- datagirdView 设定指定字母的颜色,等于H字母的为浅红色
- MVC 如何设定默认默认路由为指定的Area下的某个action
- 添加指定数量的随机联系人
- 如何设定指定logger的日志级别
- UIBarButtonItemSystemItemFixedItem设定指定宽度的barButtonItem
- ListView设定指定位置的一些注意
- 设定指定内存位置的值
- Android 指定的音乐设置成个人铃声
- 关于极光推送消息提醒并且播放指定铃声
- 设置联系人铃声
- 为指定初始化参数
- 为函数指定所有者
- 为Tomcat指定JDK
- 为EditText 指定动作
- 在VC中使用switch语句时遇到“error C2360: initialization of 'k' is skipped by 'case' label”的编译错误。
- 根据进程名获取其加载的所有可执行模块
- 稻盛和夫:经营为何需要哲学
- Iptables 完成端口映射
- 二叉树后序遍历非递归算法
- 为指定联系人设定指定铃声
- MAC下使用Tomcat+eclipse+mysql+git+jdk开发网游后台程序经验总结
- linux配置双网卡绑定,以实现冗余和负载均衡
- apt-get出现E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/list
- QT4.6中将QImage保存为JPG格式
- SWT常用样式
- iptables—过滤包—命令
- Solr 主从操作命令参考
- 关于代码覆盖