[android开发]添加图标到桌面
来源:互联网 发布:软件项目运营实施方案 编辑:程序博客网 时间:2024/06/02 22:04
1.在manifest中获得发送短信权限
<uses-permission android:name="android.permission.SEND_SMS"/>
2.代码实现
private void shareNote() { final CharSequence[] items = { getResources().getString(R.string.share_with_sms), getResources().getString(R.string.share_with_email) }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setItems(items,new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String strContent = et_content.getText().toString(); switch (which) { case 0://share with sms Uri smsToUri = Uri.parse("smsto:"); Intent mIntent = new Intent(android.content.Intent.ACTION_SENDTO, smsToUri); mIntent.putExtra("sms_body", strContent); startActivity(mIntent); Toast.makeText(NoteActivity.this, "启动" + items[which] + "程序中...", Toast.LENGTH_SHORT) .show(); break; case 1://share with email 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, "通过Mynotes分享信息"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, strContent); startActivity(Intent.createChooser(emailIntent, "选择邮件客户端")); Toast.makeText(NoteActivity.this, "启动" + items[which] + "程序中...", Toast.LENGTH_SHORT) .show(); break; default: break; } } }); AlertDialog alert = builder.create(); alert.show(); }
0 0
- [android开发]添加图标到桌面
- webapp添加网站图标到ios桌面
- Android 添加、移除桌面快捷方式图标
- android 添加快捷方式到桌面
- 添加桌面刷新图标
- 将IE8的图标添加到Windows 7的桌面
- 将“显示桌面”图标添加到快速启动栏
- windows server 2012将计算机图标添加到桌面
- Windows Server 2012 如何将计算机图标添加到桌面
- Sever 2008,2012 如何添加计算机图标到桌面
- APP实用开发—桌面添加快捷图标
- Android添加快捷方式(Short)到手机桌面
- Android添加快捷方式(Short)到手机桌面
- Android添加快捷方式(ShortCut)到手机桌面
- Android添加快捷方式(Short)到手机桌面
- Android添加快捷方式(Short)到手机桌面
- Android添加快捷方式(Short)到手机桌面
- Android添加快捷方式(CutShort)到手机桌面
- CSS 选择器
- Hadoop实战视频教程下载
- C语言经典处理与应用函数(1)
- Activity 状态事件处理程序
- Oracle字符串函数
- [android开发]添加图标到桌面
- Alpha、Beta、RC、GA版本的区别
- 金额数字转换到大写
- java 线程详解
- malloc、free与内存碎片
- QTP
- c++模板
- 同事离职
- 使用 Task 替换 ThreadPool ,异步监测所有线程(任务)是否全部执行完毕