安卓 : can i attach picture when i tweet via native Twitter app

标签 android twitter

这是我的代码

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setClassName("com.twitter.android", "com.twitter.android.PostActivity");
intent.putExtra(Intent.EXTRA_TEXT, message);
startActivity(intent);

我可以以编程方式附加图片吗?

enter image description here

编辑

解决方案

另外1行

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setClassName("com.twitter.android", "com.twitter.android.PostActivity");
intent.putExtra(Intent.EXTRA_TEXT, message);
intent.putExtra(Intent.EXTRA_STREAM, Uri);      
startActivity(intent);

最佳答案

试试这个。

Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
Uri screenshotUri = Uri.parse("file:///sdcard/image.jpg");
sharingIntent.setType("*/*");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Body text of the new status");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));

关于安卓 : can i attach picture when i tweet via native Twitter app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13062370/

相关文章:

php - 使用推文按钮 - 链接根本不会出现在推文文本中

android - 在 Android Listview 中显示 Html

android - 使用 android 媒体播放器播放 m3u8 音频文件

java - 将异常从匿名接口(interface)传递到方法签名

android - 如何以编程方式创建 admob 横幅?

javascript - 如何通过打开新窗口而不是从当前页面重定向用户来执行 OAuth 请求?

ssl - 为什么 Twitter 通过 HTTPS (SSL) 为每个页面提供服务?

ios - NSDate 根据时区字符串变化

android - 不活动,与服务断开连接 - 使用 Android Firebase

android - Android systrace 是否需要 root 访问权限?