android - How to upload a bitmap to facebook using BitmapFactory -


i working on project need upload photos android app facebook. have installed facebook sdk , done everything, managed upload status , drawables facebook. however, picture take before uploading facebook saved in bitmap variable, , when write in line of code :

"bitmap image = bitmapfactory.decoderesource(getresources(), bitmap);"  

i error :

the method decoderesource(resources, int) in type bitmapfactory not applicable arguments (resources, bitmap)

is there anyway solve problem?
here entire code "i found on website":

public class addrestaurantactivity extends fragmentactivity{       private callbackmanager callbackmanager;     private loginmanager loginmanager;       private static final int camera_request = 1888;        static string str_camera_photo_imagepath = "";     private static file f;     private static int take_photo = 2;     private static string str_randomnumber = "";     static string str_camera_photo_imagename = "";     public static string str_savefoldername;     private static file wallpaperdirectory;     bitmap bitmap;     int storeposition = 0;     public static gridview gridview;     public static imageview imageview;     bitmap faceview; @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_add_restaurant);         this.imageview = (imageview)this.findviewbyid(r.id.imageview1);         button photobutton = (button) this.findviewbyid(r.id.button1);          photobutton.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v)              {                  str_savefoldername = environment.getexternalstoragedirectory().getabsolutepath()+ "/fastfood";                 str_randomnumber = string.valueof(nextsessionid());                 wallpaperdirectory = new file(str_savefoldername);                 if (!wallpaperdirectory.exists())                     wallpaperdirectory.mkdirs();                 str_camera_photo_imagename = str_randomnumber + ".jpg";                  str_camera_photo_imagepath = str_savefoldername + "/" + str_randomnumber + ".jpg";                  system.err.println("str_camera_photo_imagepath  " + str_camera_photo_imagepath);                  f = new file(str_camera_photo_imagepath);                 startactivityforresult(new intent(                         mediastore.action_image_capture).putextra(                                 mediastore.extra_output, uri.fromfile(f)),                                 take_photo);                 system.err.println("f  " + f);             }         });     }      //clickable button     public void gotoshare(view v)     {         bitmap image = bitmapfactory.decoderesource(getresources(), faceview);         sharephoto photo = new sharephoto.builder()         .setbitmap(image)         .setcaption("semi final")         .build();          sharephotocontent content = new sharephotocontent.builder()         .addphoto(photo)         .build();          shareapi.share(content, null);     }      // used create randon numbers     public string nextsessionid() {         securerandom random = new securerandom();         return new biginteger(130, random).tostring(32);     }       protected void onactivityresult(int requestcode, int resultcode, intent data) {           if (requestcode == take_photo) {             string filepath = null;              filepath = str_camera_photo_imagepath;             if (filepath != null) {                 faceview = ( new_decode(new file(filepath)));                  imageview.setimagebitmap(faceview);             } else {                 bitmap = null;             }         }     }        public static bitmap new_decode(file f) {...} } 

the new code inside gotoshare method fixed :

public void gotoshare(view v) { //bitmap image = bitmapfactory.decoderesource(getresources(),  r.drawable.ic_launcher); bitmap image = faceview; sharephoto photo = new  sharephoto.builder().setbitmap(image).setcaption("semi final").build(); sharephotocontent content = new  sharephotocontent.builder().addphoto(photo).build(); shareapi.share(content, null); } 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -