TKumar
TKumar

Reputation: 836

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.

Upvotes: 0

Views: 1322

Answers (1)

Chinmoy Debnath
Chinmoy Debnath

Reputation: 2824

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();
                }
            });
        }
    }

Upvotes: 1

Related Questions