The official Facebook documentation on how to share with the Android SDK 4.0 is here:
https://developers.facebook.com/docs/sharing/android
This link has examples of how to share by invoking the Graph API or sharing, invoking the application’s native Facebook dialog box.
Here's how I applied the sharing dialog in my own application:
in xml for activity / fragment I added Button
<Button android:layout_width="144dp" android:layout_height="144dp" android:id="@+id/shareFacebookButton" android:text="" android:background="@drawable/facebook_button" android:layout_gravity="center" android:layout_marginBottom="6dp" />
Then inside the fragment:
Button shareButton = (Button)view.findViewById(R.id.shareFacebookButton); shareDialog = new ShareDialog(this); callbackManager = CallbackManager.Factory.create(); shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() { @Override public void onSuccess(Sharer.Result result) {} @Override public void onCancel() {} @Override public void onError(FacebookException error) {} }); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (ShareDialog.canShow(ShareLinkContent.class)) { ShareLinkContent linkContent = new ShareLinkContent.Builder() .setContentTitle("Hello Facebook") .setContentDescription("The 'Hello Facebook' sample showcases simple Facebook integration") .setContentUrl(Uri.parse("http://developers.facebook.com/android")) .build(); shareDialog.show(linkContent); } }});
Now, when someone clicks on the button, they will meet with the Facebook dialog box, as you expected.
Hope this helps.
source share