android - Posting something to status on Facebook -


i using this tutorial learn how connect facebook via android app. particularly interested in section shows how post on wall / status of user.

the tutorial straightforward requirement need let app append things along user posts.

how can achieved ?

you can this:

private void publishtofacebook(string message)       {             long songid = musicutils.getcurrentaudioid();                 long albumid = musicutils.getcurrentalbumid();             string albumarturl = musicutils.getartworkurlfromextrascache(getapplicationcontext(),albumid);             bitmap bm = musicutils.getartworkfromextrascache(getapplicationcontext(),albumid,false,false);             if(bm == null)             bm = musicutils.getdefaultartwork(getapplicationcontext());                  sharefacebookconnector = new shareconnector(mediaplaybackactivity.this, getapplicationcontext());             sharefacebookconnector.setcurrentalbum(musicutils.getcurrentalbumname());             sharefacebookconnector.setcurrentartist(musicutils.getcurrentartistname());             sharefacebookconnector.setcurrenttrack(musicutils.getcurrenttrackname());         sharefacebookconnector.setcurrentcoverart(bm);         if(albumarturl != null)         {         sharefacebookconnector.setcurrentcoverurl(albumarturl);         }          layoutinflater inflater = this.getlayoutinflater();         final view dialoglayout = inflater.inflate(r.layout.facebook_share, (viewgroup) findviewbyid(r.id.facebook_share_root));         final imageview image = (imageview) dialoglayout.findviewbyid(r.id.facebook_cover_view);         input = (edittext) dialoglayout.findviewbyid(r.id.facebook_share_content);         contextthemewrapper ctw = new contextthemewrapper(this, r.style.alertdialogcustom);         alertdialog.builder alert = new alertdialog.builder(ctw);            if(message != null)         {                 sharefacebookconnector.publishtofacebook(alert, input, message);             }         else         {         sharefacebookconnector.publishtofacebook(alert, input, null);           }         alert.setview(dialoglayout);         alert.setpositivebutton("ok", new dialoginterface.onclicklistener() {         public void onclick(dialoginterface dialog, int whichbutton) {               balertinprogress = false;              string messagetopost = input.gettext().tostring();             sharefacebookconnector.postmessagetowall(messagetopost, false);                  }      });     alert.setnegativebutton("cancel", new dialoginterface.onclicklistener() {          public void onclick(dialoginterface dialog, int whichbutton) {             balertinprogress = false;             toast.maketext(mediaplaybackactivity.this, "wall post cancelled !", toast.length_short).show();             //finish();              }     });     balertinprogress = true;     msharekey = "********";     alertdialog = alert.create();     alertdialog.show(); } 

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 -