`
hulianwang2014
  • 浏览: 692143 次
文章分类
社区版块
存档分类
最新评论
  • bcworld: 排版成这样,一点看的欲望都没有了
    jfinal

完美实现同时分享图片和文字(Intent.ACTION_SEND)

 
阅读更多

使用以下代码可以很好的完成同时分享图片和文字的功能

  1. privatevoidshare(Stringcontent,Uriuri){
  2. IntentshareIntent=newIntent(Intent.ACTION_SEND);
  3. if(uri!=null){
  4. shareIntent.putExtra(Intent.EXTRA_STREAM,uri);
  5. shareIntent.setType("image/*");
  6. //当用户选择短信时使用sms_body取得文字
  7. shareIntent.putExtra("sms_body",content);
  8. }else{
  9. shareIntent.setType("text/plain");
  10. }
  11. shareIntent.putExtra(Intent.EXTRA_TEXT,content);
  12. //自定义选择框的标题
  13. //startActivity(Intent.createChooser(shareIntent,"邀请好友"));
  14. //系统默认标题
  15. startActivity(shareIntent);
  16. }
分享到:
评论

相关推荐

    Android利用Intent.ACTION_SEND进行分享

    安卓系统本身可以很简便的实现分享功能,因为我们只需向startActivity传递一个ACTION_SEND的Intent,系统就为我们弹出一个应用程序列表。其实在系统的文件管理器中,这应该是我们常用的功能(包括文件的打开Intent....

    Android使用Intent.ACTION_SEND分享图片和文字内容的示例代码

    本文讲述了Android版Intent.ACTION_SEND分享图片和文字内容。分享给大家供大家参考,具体如下: 编辑推荐:稀土掘金,这是一个针对技术开发者的一个应用,你可以在掘金上获取最新最优质的技术干货,不仅仅是Android...

    用Intent.ACTION_SEND进行分享

    http://blog.csdn.net/xuie0000/article/details/50604741用例

    android.intent.action.TIME_TICK

    接收系统的时间流逝的广播,屏幕开启关闭的广播,电量改变的广播。这些广播在清单文件里注册时,看不到效果。在这个例子中通过在一个服务里面用代码注册的方式,成功接收了这些广播。

    Andriod接收广播的类

    恢复已经停止的更新下载。 'android.server.checkin.FOTA_RESTART' 通过 OTA 下载并安装操作系统更新。 'android.server.checkin.FOTA_UPDATE' 用户按下了'Media Button'。...'android.intent.action.PACKAGE_ADDED'

    Intent.action_大全

    Android Intent Action

    Android中获取系统图片示例

    获取系统图片的简单示例,使用Intent.ACTION_GET_CONTENT 和 MediaStore两种方式获取图片以及其真正的系统所在的位置

    android 监听卸载那些事儿

    android.intent.action.PACKAGE_REMOVED和android.intent.action.PACKAGE_ADDED 可以监听别的应用被安装卸载,但不能监听自己被卸载啊。 监听自己被卸载通过前辈们探索发现,只能通过监听系统卸载log如:act=...

    android Intent实例

    returnIt = new Intent(Intent.ACTION_SEND); String[] tos = { "shenrenkui@gmail.com" }; String[] ccs = { "shenrenkui@gmail.com" }; returnIt.putExtra(Intent.EXTRA_EMAIL, tos); returnIt.putExtra(Intent....

    android-将内容分享到自己的app

    像qq,微信那样 调用代码Intent intent=new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "分享"); intent.putExtra(Intent.EXTRA_TITLE, mTitle....

    Android 静默安装和静默卸载(SilentInstaller)

    Intent intent = new Intent("android.intent.action.SILENT_PACKAGE_INSTALL"); intent.putExtra("silent_install_file", "/sdcard/Helloworld.apk"); intent.putExtra("silent_install_auto_start", true);//...

    android开发使用例子

    Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); it.putExtra(Intent.EXTRA_STREAM, "[url=]file:///sdcard/eoe.mp3[/url]"); sendIntent.setType(...

    Android 屏幕唤醒 + 屏幕解锁 + 开机服务监听(android.intent.action.BOOT-COMPLET)

    Android 屏幕唤醒 + 屏幕解锁 + 开机服务监听(android.intent.action.BOOT_COMPLET)添加权限:{//开机监听<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>...LOCK"/>...

    Android功能代码

    intent.setAction("android.intent.action.VIEW"); startActivityForResult( intent , 0); 3.打开壁纸设置 Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER); startActivity(intent); 4.打开拨号界面 ...

    AppInstall.rar

    Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); intent.addFlags(Intent.FLAG_...

    android Action call 拨打电话 Intent.ACTION.CALL

    android Action call 拨打电话 Intent.ACTION.CALL

    ex07_activity_intent.rar_Intent_android

    ex07_activity_intent 介绍在android中如何使用intent

Global site tag (gtag.js) - Google Analytics