简体   繁体   中英

How to Post Status on facebook wall using my own Textview?

I am using facebook defaul dialog to share post on my facebook wall . My code is given below .

facebook.dialog(this, "feed", new DialogListener() {

        @Override
        public void onFacebookError(FacebookError e) {
        }

        @Override
        public void onError(DialogError e) {
        }

        @Override
        public void onComplete(Bundle values) {
        }

        @Override
        public void onCancel() {
        }
    });

But now I am adding a TextView and a Button , and after clicking on button the textView text will be posted on my facebook wall.

Override onComplete() in your DialogListener then do what you want or get the value using getText from the textview and post it.

public void onComplete(Bundle values) { 
            mProgress.setMessage("Posting ...");
            mProgress.show();

            AsyncFacebookRunner mAsyncFbRunner = new AsyncFacebookRunner(mFacebook);

            Bundle params = new Bundle();

            params.putString("message", "A Game Developed By Me !");
            params.putString("name", "Match Maker");
            params.putString("caption", "www.labmimosa.com/");
            params.putString("link", "https://play.google.com/store/apps/details?id=com.reverie.fushh");
            params.putString("description", "Dexter:  Blood. Sometimes it sets my teeth on edge, other times it helps me control the chaos.");
            params.putString("picture", "http://twitpic.com/show/thumb/6hqd44");
            //params.putByteArray("picture", bitMapData);

            mAsyncFbRunner.request("me/feed", params, "POST", new WallPostListener());
        }

Wallpostlistener class is

private final class WallPostListener extends BaseRequestListener {
        public void onComplete(final String response) {
            mRunOnUi.post(new Runnable() {
                @Override
                public void run() {
                    mProgress.cancel();

                    Toast.makeText(Exp_Fb_Twt_Activity.this, "Posted to Facebook", Toast.LENGTH_SHORT).show();
                }
            });
        }
    }

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