Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6960907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:27:43+00:00 2026-05-27T15:27:43+00:00

I make an application in which I make an EditText and a button. I

  • 0

I make an application in which I make an EditText and a button. I want to be post that message which is written on EditText on the Facebook friends wall after clicked on the button. Please give me some idea how we can perform this task using Facebook sdk.

The code is below:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        this.setContentView(R.layout.post_wall);

        share = (Button) findViewById(R.id.share);
        friend_name = (TextView) findViewById(R.id.wall_to);
        wall = (EditText) findViewById(R.id.wall);

        savedInstanceState = new Bundle();
        savedInstanceState.getString("to");

        onComplete(savedInstanceState);

    }

@Override public void onComplete(Bundle values)
    {

        Utility.currentPermissions.clear();


        if (values.isEmpty())
        {
            //"skip" clicked ?
            return;
        }

        // if facebookClient.authorize(...) was successful, this runs
        // this also runs after successful post
        // after posting, "to"(which is the id of friend) is added to the values bundle
        // I use that to differentiate between a call from
        // faceBook.authorize(...) and a call from a successful post
        // is there a better way of doing this?
        if (!values.containsKey("to"))
        {
            try
            {
                Log.d("Wall try", "Click successfully");

                for (String key : parameters.keySet()) {
                    if (parameters.getByteArray(key) != null) {
                        parameters.putByteArray(key, parameters.getByteArray(key));

                        Log.d("key", parameters.getByteArray(key).toString());
                    }
                }

                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        performActivityInfo();
                    }
                });


            }
            catch (Exception e)
            {
                // TODO: handle exception
                System.out.println(e.getMessage());
            }
        }
    }



protected void performActivityInfo() {

        Log.d("perform wall", "Perform Activity");
        mHandler.sendEmptyMessage(FRIEND_WALL);


        parameters.putString("message", wall.getText().toString());
        facebookClient.dialog(this, "stream.publish", parameters, this);// "stream.publish" is an API call
        Log.d("Wall post", "Click successfully");

    }

    public Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
            case FRIEND_WALL:
                Log.d("Handler WALL", "Handler");
                postOnWall(wall.getText().toString());
                break;
            }
            super.handleMessage(msg);
        }
    };



 @Override
    public void onError(DialogError e)
    {
        System.out.println("Error: " + e.getMessage());
    }

    @Override
    public void onFacebookError(FacebookError e)
    {
        System.out.println("Error: " + e.getMessage());
    }

    @Override
    public void onCancel()
    {
    }

    @Override
    public void onClick(View v)
    {
            facebookClient = new Facebook(APP_ID);
            // replace APP_API_ID with your own
            Log.d("Wall click", "Click successfully");
            facebookClient.authorize(this,
                new String[] {"publish_stream", "read_stream", "offline_access"}, this);
    }

    public void postOnWall(String msg) {
        Log.d("Tests", "Testing graph API wall post");
         try {
                String response = facebookClient.request("me");
                Bundle parameters = new Bundle();
                parameters.putString("message", msg);
                parameters.putString("description", "test test test");
                response = facebookClient.request("me/feed", parameters, 
                        "POST");
                Log.d("Tests", "got response: " + response);
                if (response == null || response.equals("") || 
                        response.equals("false")) {
                   Log.v("Error", "Blank response");
                }
         } catch(Exception e) {
             e.printStackTrace();
         }
    }

Thanks in Advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:27:44+00:00Added an answer on May 27, 2026 at 3:27 pm

    For getting the value from Edit Text just use :

    EditText edittext;

    edittext.getEditableText().toString();
    

    Inside Button click Listener use this code then

    button.setOnClickListener(new OnClickListener(){
    
            @Override
            public void onClick(View arg0) {
                String entered_value=edittext.getEditableText().toString();
                try{
                    parameters.putString("message", entered_value);
                    parameters.putString("target_id", "XXXXX"); // target Id in which you need to Post 
                    parameters.putString("method", "stream.publish");
                    String  response = authenticatedFacebook.request(parameters);       
                    Log.v("response", response);
                }
                catch(Exception e){}
            }
        });
    

    where button is your button Object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a application written in wxPython which I want to make multilingual. Our
I want to make application in which i want to use camera as after
Suppose I want to make a Web application which uses a fixed width and
I want to make an console application of c which can run other applications
I want to make an application in C or C++ which have to monitor
I want to make an application which prevents other applications to launch without user
I want to make an application which has auto start option in its settings.
I am trying to make an application which integrates facebook and twitter. I have
i m the beginner in iphone programming i want to make an application which
i want to make an application which includes dynamic screensaver. User can select multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.