android调用系统功能
16lz
2022-06-14
附带电话号码(调用系统短信):
Intent mIntent = new Intent(Intent.ACTION_VIEW); mIntent.putExtra("address",phoneNum); mIntent.putExtra("sms_body", ""); mIntent.setType("vnd.android-dir/mms-sms"); context.startActivity(mIntent);
附带短信内容(调用系统短信):
Uri smsToUri = Uri.parse("smsto:");// 联系人地址Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO,smsToUri);mIntent.putExtra("sms_body","abcdefgh");// 短信内容context.startActivity(mIntent);附带邮件内容(调用系统邮件):
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);// 文本格式emailIntent.setType("text/plain");// 对方邮件地址emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, "");// 标题内容emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");// 邮件文本内容emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"abcdefgh");context.startActivity(Intent.createChooser(emailIntent,"Choose Email Client"));
调用系统添加联系人:
Intent intent = new Intent(Intent.ACTION_INSERT,Contacts.CONTENT_URI);intent.putExtra("name", "");intent.putExtra("phone", number);context.startActivity(intent);调用系统添加或编辑联系人:
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);intent.setType("vnd.android.cursor.item/contact");intent.putExtra(Intents.Insert.PHONE, number);context.startActivity(intent);调用系统编辑联系人:
Intent i = new Intent(Intent.ACTION_EDIT); i.setData(ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI,contactid)); context.startActivity(i);
更多相关文章
- android例子
- Android中多层Fragment嵌套,调用相册返回Uri无法显示图片的问题解
- Android(安卓)8.0 启动后台service 出错 IllegalStateException:
- Android生命周期的学习
- 【转】Android获取用于操作数据库的SQLiteDatabase实例【学习记
- Android(安卓)Service Bind启动调用service方法
- Android简单例子(拨号服务调用)
- [Android]当Activity启动模式为singleTask时的生命周期
- Android中Linux睡眠唤醒流程