Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Facebook Share button in Android Application

I am beginner in android.I want to add FacebookShare button in my android application.I create the app in 2.2 .please help me I use this code

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain"); 
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getResources().getStri‌​ng(R.string.title_activity_android_face_book_share));
emailIntent.putExtra(android‌​.content.Intent.EXTRA_TEXT,getResources().getString(R.string.title_activity_android_face_book_share));  
startActivity(emailIntent); 

I Use the following link also Best way for social sharing in Android

like image 596
dran Avatar asked Nov 15 '12 11:11

dran


People also ask

Why there is no share option on Facebook Mobile?

Unfortunately, there's no way to force the “Share” button to appear on posts that you mark as “Friends. That's just the way it is now. But that being said, if you really want as many Facebook users as possible to see a given post you can always change its privacy level to “Public”.

How can I see Facebook shares on Android?

It's just as simple to do. Go to the post in question, such as on a Facebook page or friend's account, then select Share. You'll see a list of the people who have shared the post. Depending on the person's privacy settings, you might not see everyone who has shared the post.


1 Answers

  Intent shareIntent = new Intent(Intent.ACTION_SEND);
  shareIntent.setType("text/plain");
  shareIntent.putExtra(Intent.EXTRA_TEXT, "URLyouWantToShare");
  startActivity(Intent.createChooser(shareIntent, "Share..."));

Use the ACTION_SEND Intent, add the URL you want to share. User will be given a selection of apps to accept the share intent such as facebook etc.

like image 76
James Kidd Avatar answered Sep 27 '22 20:09

James Kidd