Android Share Image from Phone Gallery to Facebook using Facebook API -


i trying have android application share uri image facebook. when using picture parameter, forces use url of picture. since trying share phones gallery, wondering if there way have uri read url, or other way this. suggestions?

update: have updated adding code attempting use. understand not using newly rolled out api of facebook. want able post picture phone gallery facebook, , not picture url. thank you!

private string[] arrpath; int id = viewit.getid(); if(facebook.issessionvalid()) {                                         bundle params = new bundle();                                         params.putstring("name", "androidapp");                                         params.putstring("caption", "application android");                                         params.putstring("description", "this description");                                         params.putstring("link", "http://www.google.com/");                                         params.putstring("picture", "file://" + arrpath[id]);                                          facebook.dialog(androidclass.this, "feed", params, new dialoglistener() {                                              @override                                             public void onfacebookerror(facebookerror e) {                                                 // todo auto-generated method stub                                              }                                              @override                                             public void onerror(dialogerror e) {                                                 // todo auto-generated method stub                                              }                                              @override                                             public void oncomplete(bundle values) {                                                 // todo auto-generated method stub                                              }                                              @override                                             public void oncancel() {                                                 // todo auto-generated method stub                                              }                                         });                                     }else {                                         facebook.authorize(androidclass.this, new string[] {"email", "publish_stream"}, new dialoglistener() {                                              @override                                             public void onfacebookerror(facebookerror e) {                                                 // todo auto-generated method stub                                                 toast.maketext(androidclass.this, "fberror", toast.length_short).show();                                             }                                              @override                                             public void onerror(dialogerror e) {                                                 // todo auto-generated method stub                                                 toast.maketext(androidclass.this, "onerror", toast.length_short).show();                                             }                                              @override                                             public void oncomplete(bundle values) {                                                 // todo auto-generated method stub                                                 editor editor = sp.edit();                                                 editor.putstring("access_token", facebook.getaccesstoken());                                                 editor.putlong("access_expires", facebook.getaccessexpires());                                                  editor.commit();                                              }                                              @override                                             public void oncancel() {                                                 // todo auto-generated method stub                                                 toast.maketext(androidclass.this, "oncancel", toast.length_short).show();                                              }                                         });                                     }                                 }                              }); 

you open stream image uri , post way using contentresolver.

session session = session.getactivesession(); bitmap photo = bitmapfactory.decodestream(getcontentresolver().openinputstream(uri)); request request = request.newuploadphotorequest(session, photo, new request.callback()); requestasynctask task = new requestasynctask(request); task.execute(); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -