简体   繁体   中英

How can i share bitmap in facebook in android?

In my app sharing bitmap to facebook .Link,description,message and imageurl all posting the facebook well but bitmap not share to facebook. I am using the following code:

Bitmap bi = BitmapFactory.decodeResource(getResources(),   R.drawable.ic_launcher);
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          bi.compress(Bitmap.CompressFormat.JPEG, 20, baos);
    byte[]      data = baos.toByteArray();



if ( friend_uid != null ) {
                   final Activity activity = SocialSharingActivity.this;
                   Bundle params = new Bundle();
                   params.putString("name", "pictabsample");
                   params.putByteArray("picture",data);
////                   params.pu
                   params.putString("to", friend_uid);
//                 
                   WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(SocialSharingActivity.this, Session.getActiveSession(), params))
                           .setOnCompleteListener(new OnCompleteListener() {

                            @Override
                            public void onComplete(Bundle values,
                                    FacebookException error) {

                            }}).build();
                   feedDialog.show();
               }

where i done mistake didn't findout.please tell me anyone known advance thanks to all

May be you should not transfer bitmap data to SocialSharingActivity

params.putString("path",picturePath);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM