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 6677007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:03:50+00:00 2026-05-26T04:03:50+00:00

I have to send a link on user’s facebook wall. I am trying but

  • 0

I have to send a link on user’s facebook wall. I am trying but not getting success.
I wrote the code but its not working. First i write:

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;

import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.DialogError;
import com.facebook.android.Facebook;
import com.facebook.android.FacebookError;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class FacebookActivity extends Activity {
    /** Called when the activity is first created. */
    Facebook face;
    AsyncFacebookRunner run;
    String[] permission=new String[] {"publish_stream", 
            "read_stream", "offline_access"};

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        face=new Facebook("my key");
        run=new AsyncFacebookRunner(face);
        face.authorize(this, permission,new MyLoginDialogListener());

    }
    private final class MyLoginDialogListener implements com.facebook.android
    .Facebook.DialogListener {

public void onComplete(Bundle values) {

    Toast.makeText(FacebookActivity.this, "Ho Gya Authorize",Toast.LENGTH_LONG).show();
    run=new AsyncFacebookRunner(face);
    Bundle bundle=new Bundle();
    bundle.putString("message", " hello");
    bundle.putString("name", "hello");
    bundle.putString("description", "Hello");
    bundle.putString("link", "http://www.facebook.com");
     try {
        face.request("me/feed",bundle, "POST");
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
} // here enable logout
public void onFacebookError(FacebookError error) {}
public void onError(DialogError error) {}
public void onCancel() {}
}


    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        face.authorizeCallback(requestCode, resultCode, data);
    }
}

Please suggest how to proceed further. My code is not posting on the wall of user’s wall.

  • 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-26T04:03:51+00:00Added an answer on May 26, 2026 at 4:03 am

    Sample code for posting wall on facebook

      public class AndroidFacebookSample extends Activity {
    
    private static final String FACEBOOK_APPID = "PUT YOUR FACEBOOK APP ID HERE";
    private static final String FACEBOOK_PERMISSION = "publish_stream";
    private static final String TAG = "FacebookSample";
    private static final String MSG = "Message from FacebookSample";
    
    private final Handler mFacebookHandler = new Handler();
    private TextView loginStatus;
    private FacebookConnector facebookConnector;
    
    final Runnable mUpdateFacebookNotification = new Runnable() {
        public void run() {
            Toast.makeText(getBaseContext(), "Facebook updated !", Toast.LENGTH_LONG).show();
        }
    };
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.facebookConnector = new FacebookConnector(FACEBOOK_APPID, this, getApplicationContext(), new String[] {FACEBOOK_PERMISSION});
    
    
        loginStatus = (TextView)findViewById(R.id.login_status);
        Button tweet = (Button) findViewById(R.id.btn_post);
        Button clearCredentials = (Button) findViewById(R.id.btn_clear_credentials);
    
        tweet.setOnClickListener(new View.OnClickListener() {
    
            public void onClick(View v) {
                postMessage();
            }
        });
    
        clearCredentials.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                clearCredentials();
                updateLoginStatus();
            }
        });
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        this.facebookConnector.getFacebook().authorizeCallback(requestCode, resultCode, data);
    }
    
    
    @Override
    protected void onResume() {
        super.onResume();
        updateLoginStatus();
    }
    
    public void updateLoginStatus() {
        loginStatus.setText("Logged into Twitter : " + facebookConnector.getFacebook().isSessionValid());
    }
    
    
    private String getFacebookMsg() {
        return MSG + " at " + new Date().toLocaleString();
    }   
    
    public void postMessage() {
    
        if (facebookConnector.getFacebook().isSessionValid()) {
            postMessageInThread();
        } else {
            SessionEvents.AuthListener listener = new SessionEvents.AuthListener() {
    
                @Override
                public void onAuthSucceed() {
                    postMessageInThread();
                }
    
                @Override
                public void onAuthFail(String error) {
    
                }
            };
            SessionEvents.addAuthListener(listener);
            facebookConnector.login();
        }
    }
    
    private void postMessageInThread() {
        Thread t = new Thread() {
            public void run() {
    
                try {
                    facebookConnector.postMessageOnWall(getFacebookMsg());
                    mFacebookHandler.post(mUpdateFacebookNotification);
                } catch (Exception ex) {
                    Log.e(TAG, "Error sending msg",ex);
                }
            }
        };
        t.start();
    }
    
    private void clearCredentials() {
        try {
            facebookConnector.getFacebook().logout(getApplicationContext());
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    

    }

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

Sidebar

Related Questions

I have service which is not invoked by user request, but by task. Now
After user places an order I have to send detailed email message containing order
i have an app that sends out email but i have to only send
I'm kinda new to Flex. I have trying to send Hash from Ruby on
i,m trying to write a trigger in SalesForce Opportunity which have to send the
I have a user created button to send data from store to server side
The scenario is to send the clicked link text to server where i have
When a user clicks a link, I would like to send an AJAX request
I have a script that detects whether you're an iPhone user or not and
I'm fairly new to user authentication, but have built some standard user authentication processes

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.