Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
hello, Im a bit new in android .I have successfully done posting in my own wall and I wish to post on my friends' wall through my android mobile app. The above example code fits best for my requirement.

BUT I do not understand where to get the userID from(that has to be passed as a string to this method). Please please guide me and provide me with something that would give me the IDs of user's fiends..

here is he link where I found this code:
http://stackoverflow.com/questions/6480582/how-can-i-post-text-on-a-friends-wall-using-the-android-facebook-sdk[^]
My requirement is exactly the same!

C#
protected void postToWall(String userID){
try {
    if (isSession()) {
        String response = mFacebook.request((userID == null) ? "me" : userID);

        Bundle params = new Bundle();
        params.putString("message", "put message here");
        params.putString("link", "some link");
        params.putString("caption", "{*actor*} just posted this!");
        params.putString("description", "description of my link.  Click the link to find out more.");
        params.putString("name", "Name of this link!");
        params.putString("picture", "some pciture");

        response = mFacebook.request(((userID == null) ? "me" : userID) + "/feed", params, "POST");

        Log.d("Tests",response);
        if (response == null || response.equals("") ||
                response.equals("false")) {
            Log.v("Error", "Blank response");
        }
    } else {
        // no logged in, so relogin
        Log.d(TAG, "sessionNOTValid, relogin");
        mFacebook.authorize(this, PERMS, new LoginDialogListener());
    }
}catch(Exception e){
    e.printStackTrace();}
Posted
Updated 29-May-14 0:16am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900