Sunday 19 April 2015

Post a Picture using Facebook sdk 4.01 Android

Use this Method to post Image on facebook using facebook 4.01 SDK. To login follow previous tutorials.



private void postPhoto() {

        Bitmap image = BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_launcher);

        SharePhoto sharePhoto = new SharePhoto.Builder().setBitmap(image).build(); // oR SharePhoto sharePhoto = new SharePhoto.Builder().setImageUrl("path").build();

        ArrayList<SharePhoto> photos = new ArrayList<>();

        photos.add(sharePhoto);

        SharePhotoContent sharePhotoContent =

                new SharePhotoContent.Builder().setRef("Testing picture post").setPhotos(photos).build();

            ShareApi.share(sharePhotoContent, shareCallback);

       

    }

No comments:

Post a Comment