短信分享

来源:互联网 发布:mac硬盘清理工具 编辑:程序博客网 时间:2024/05/16 12:33
Uri smsToUri = Uri.parse( "smsto:" );  Intent sendIntent =  new  Intent(Intent.ACTION_VIEW, smsToUri);  //sendIntent.putExtra("address", "123456"); // 电话号码,这行去掉的话,默认就没有电话   sendIntent.putExtra( "sms_body" ,  "我要共享这个软件" );  sendIntent.setType( "vnd.android-dir/mms-sms" );  startActivityForResult(sendIntent, 1002 );  




Intent intent = new Intent(Intent.ACTION_SEND);// intent.setType("text/plain"); //纯文本// 图片分享intent.setType("image/png");// 添加图片File f = new File("/sdcard/sd.png");Uri u = Uri.fromFile(f);intent.putExtra(Intent.EXTRA_STREAM, u); //添加图片intent.putExtra(Intent.EXTRA_SUBJECT, "分享");intent.putExtra(Intent.EXTRA_TEXT, "I would like to share this with you...");startActivity(Intent.createChooser(intent, getTitle()));


0 0
原创粉丝点击