发送图像使用ACTION.SEND机器人 [英] Send Image Using ACTION.SEND android

查看:162
本文介绍了发送图像使用ACTION.SEND机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文件夹的资产,我怎么能使用ACTION.SEND意图将其发送到Gmail或Facebook的exept其他应用(我知道如何使用JSON)?
我用这code,但它不工作,我已经试过这么多东西,甚至附加文件到Gmail的成功,但在发送的时候,没有什么会是后到Gmail帐户!

 意图sendIntent =新意图(Intent.ACTION_SEND);
 sendIntent.putExtra(SMS_BODY体);
 sendIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(文件:///android_assets/T1.png);
 sendIntent.setType(图像/ PNG);
 startActivity(sendIntent);


解决方案

 意图emailIntent =新意图(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL,新的String [] {test@test.com});
emailIntent.putExtra(Intent.EXTRA_SUBJECT,电子邮件主题);
emailIntent.putExtra(Intent.EXTRA_TEXT,Html.fromHtml(< B>大胆邮件正文和LT; / B>中));
emailIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(文件:/sdcard/test.txt));
emailIntent.setType(应用程序/八位字节流);
startActivity(Intent.createChooser(emailIntent,发送电子邮件));

I have Files in Asset folder , how can i send them using ACTION.SEND intent to Gmail or Other apps exept Facebook (i know how to use JSON)? i am using this code but it does not work, i have tried so many things , even Attaching File to GMAIL is successful but when sending it , nothing will be post to Gmail account!

 Intent sendIntent = new Intent(Intent.ACTION_SEND);
 sendIntent.putExtra("sms_body", body);
 sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///android_assets/T1.png");
 sendIntent.setType("image/png");
 startActivity(sendIntent);

解决方案

Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"test@test.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Email subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml("<b>Bold message body</b>"));
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:/sdcard/test.txt"));
emailIntent.setType("application/octet-stream");
startActivity(Intent.createChooser(emailIntent, "Send Email"));

这篇关于发送图像使用ACTION.SEND机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆