Share link in facebook android example

Share link in facebook android example

Here, I have written the simple code to share the link in facebook android example using the facebook application.

1. Create the link what you are going to share,

String urlToShare = "";
2. Create the intent to share the link,
Intent intent = newIntent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, urlToShare);

3. Get all the available application to share the data using the ResoveInfo.

List<ResolveInfo> matches = getPackageManager().queryIntentActivities(intent, 0);
4. Filter the facebook application from the group of application available to share the data.
for (ResolveInfo info : matches) {
if (info.activityInfo.packageName.toLowerCase().startsWith("com.facebook")) {
facebookAppFound = true;

5. startActivity to share the link with the Facebook,


1 thought on - Share link in facebook android example

  • if i want to share a link on a other social network, how will i do ?

Leave a Reply

Your email address will not be published. Required fields are marked *