public void facebookPhotoShare(View view) { if (ShareDialog.canShow(SharePhotoContent.class)) { Bitmap screenshot = Screenshot(); SharePhoto photo = new SharePhoto.Builder() .setBitmap(screenshot) .build(); SharePhotoContent content = new SharePhotoContent.Builder() .addPhoto(photo) .build(); shareDialog.show(content); } }
public void facebookClick(View view) { try { if (ShareDialog.canShow(ShareLinkContent.class)) { ShareLinkContent linkContent = new ShareLinkContent.Builder() .setContentTitle("I just scored " + score + "!") .setContentDescription( "Beat my score on Android!") .setContentUrl(Uri.parse("http://www.example.com")) .setImageUrl(Uri.parse("http://www.example.com")) .build(); shareDialog.show(linkContent); } } catch (Exception e) { Toast.makeText(getApplicationContext(), "Error Sharing with Facebook.", Toast.LENGTH_LONG).show(); } }