2

I need to integrate Facebook and Twitter I'm my app: a simple share button.
Is there a library to do this ? Which the best ? Official only !?

enfix
  • 6,680
  • 12
  • 55
  • 80
  • Check this following Link. [http://stackoverflow.com/questions/4057463/facebook-and-twitter-integration-with-my-android-application][1] [1]: http://stackoverflow.com/questions/4057463/facebook-and-twitter-integration-with-my-android-application – Rajesh Rajaram Sep 15 '12 at 11:31
  • http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/ http://automateddeveloper.blogspot.in/2011/06/android-twitter-oauth-authentication.html – rajeshwaran Sep 15 '12 at 11:38
  • possible duplicate of [twitter integration on android app](http://stackoverflow.com/questions/1782743/twitter-integration-on-android-app) – Nikhil Sep 15 '12 at 12:00

2 Answers2

3

If you just want to share simple text from your app to Facebook or Twitter and so on... I would recommend to create a chooser to let the user pick which app from his phone he wants to user for sharing. It is simpler, more reliable and more the 'android way' of doing it.

Here is the code that you have to write :

Intent shareIntent=new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT,"I want to share this with you!");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Great Post");
startActivity(Intent.createChooser(shareIntent, "Share..."));

Otherwise As for facebook and twitter, you can do this through their API.

Facebook Sdk for android Developers.

And for Twitter you can use external libraries as written on twitter developer docs, and there is a library called Twitter4J that is android ready.

Chirag
  • 56,621
  • 29
  • 151
  • 198