0

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.

TKumar
  • 818
  • 2
  • 10
  • 35

1 Answers1

1

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();
                }
            });
        }
    }
Chinmoy Debnath
  • 2,814
  • 16
  • 20
  • Thanks for answering my question .. I have one confusion , how to implement WallPostListener class ? – TKumar Oct 02 '12 at 07:53
  • i have added that class, its nothing only a base request listener class. – Chinmoy Debnath Oct 02 '12 at 08:40
  • 1
    Please follow this link https://github.com/chinmoy12/Experiment-Project/tree/master/Exp_Fb_Twt – Chinmoy Debnath Oct 02 '12 at 09:05
  • Thanks for helping me. How can I upload my SD card image on facebook ? – TKumar Oct 02 '12 at 09:46
  • http://stackoverflow.com/questions/10510071/facebook-api-android-wall-post-publish-with-image-attachment-not-working http://stackoverflow.com/questions/5170355/android-send-a-facebook-post-with-custom-actions – Chinmoy Debnath Oct 03 '12 at 06:29
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/17481/discussion-between-tkumar-and-chinmoy-debnath) – TKumar Oct 03 '12 at 06:47