【问题标题】:How to show all share options in android?如何在android中显示所有共享选项?
【发布时间】:2012-07-04 13:14:51
【问题描述】:

我正在开发一个 Android 应用程序,并希望通过打开所有
设备中可用的共享选项。但目前该列表显示的是电子邮件、蓝牙、Gmail 和消息传递。

BBC 新闻等其他应用在 Bump、Picasa 等同一设备上显示了更多选项。如何显示所有可用选项并处理它们?

我正在使用这个:

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/vcard");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,mailBody);            
startActivity(Intent.createChooser(sharingIntent,"Share using"));   

在清单中

 <intent-filter>
  <action android:name="android.intent.action.SEND" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:mimeType="text/plain"/>
  </intent-filter>

【问题讨论】:

  • 如果没有解决,则使用&lt;data android:mimeType="image/*"&gt; 而不是&lt;data android:mimeType="text/plain"/&gt; 这将显示所有选项,包括 Bump、Picasa

标签: android share


【解决方案1】:

这是因为您只显示注册以处理 text/vcard 的意图而不是使用

sharingIntent.setType("text/plain");

【讨论】:

  • 在通过 bluttoth 或短信或其他任何方式分享后,它给了我黑屏如何克服这个问题,以便将我带到我的前一个屏幕
【解决方案2】:
Intent i=new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject test");
i.putExtra(android.content.Intent.EXTRA_TEXT, "extra text that you want to put");
startActivity(Intent.createChooser(i,"Share via"));

【讨论】:

  • @AndDev21 很高兴为您提供帮助,如果此答案对您有所帮助,请将其标记为已接受,这样也可能对其他人有所帮助。享受编码。
【解决方案3】:

仅用于共享文本 sharedIntent.setType("text/plain"); 并为 sgaring 图像使用 sharedIntent.setType("image/*");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-07
    • 2019-01-21
    • 1970-01-01
    • 2016-04-05
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多