URL共享到Facebook,Twitter和电子邮件中的Andr​​oid? [英] Sharing URL to Facebook, Twitter and email in Android?

查看:108
本文介绍了URL共享到Facebook,Twitter和电子邮件中的Andr​​oid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么类似getsharekit.com为Android?它允许共享URL的社交网站。有什么与此类似或者我需要code分别对Facebook,Twitter和电子邮件?

Is there anything similar to getsharekit.com for Android? It allows to share URL's to social networking sites. Is there anything similar to this or do I need to code separately for facebook, Twitter and email?

推荐答案

我不知道,如果这就是你的意思,但你可以使用Android内置的共享菜单...

I don't know if that's what you mean but you can use the Android built-in sharing menu...

您可以共享URL到Facebook,Twitter,Gmail和更多的(只要这些应用程序安装到您的设备上)使用意图:

You can share a URL to Facebook, Twitter, Gmail and more (as long as the apps are installed on your device) using Intents:


Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Sharing URL");
i.putExtra(Intent.EXTRA_TEXT, "http://www.url.com");
startActivity(Intent.createChooser(i, "Share URL"));

如果你想分享给没有安装在用户的设备上,例如应用程序 - 脸谱,那么你就必须使用Facebook SDK

If the app you want to share to is not installed on the user's device, for example - facebook, then you'll have to use Facebook SDK.

如果你希望你的活动,以处理从其他应用程序共享文本数据,以及,你可以添加到您的Andr​​oidManifest.xml:

If you want your Activity to handle text data shared from other apps as well, you can add this to your AndroidManifest.xml:

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

希望这有助于!

Hope this helps!

这篇关于URL共享到Facebook,Twitter和电子邮件中的Andr​​oid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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