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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:28:44+00:00 2026-06-04T04:28:44+00:00

I made a little example for posting messages to facebook feed via Android app.

  • 0

I made a little example for posting messages to facebook feed via Android app.
It works great but i just want to add more content to the post like the facebook page’s icon, a link and more stuff..

How can i add these parameters to my facebook dialog to post them as well?

public class MainActivity extends Activity 
{

   Facebook facebook = new Facebook("Here i got my app id.");

   @Override
   public void onCreate(Bundle savedInstanceState) 
   {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);

      // Posting my message, maybe here i could add paramterers like icon and a link etc..?
      facebook.dialog(MainActivity.this, "feed", new PostDialogListener());
   }

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

    super.onActivityResult(requestCode, resultCode, data);
    facebook.authorizeCallback(requestCode, resultCode, data);

   }

 public abstract class BaseDialogListener implements DialogListener {
        @Override
        public void onFacebookError(FacebookError e) {


    e.printStackTrace();
}
@Override
public void onError(DialogError e) {
        e.printStackTrace();
    }
    @Override
    public void onCancel() {
    }


  }

    public class PostDialogListener extends BaseDialogListener {
        @Override
        public void onComplete(Bundle values) {
            final String postId = values.getString("post_id");
            if (postId != null) {
               ki("Message posted on the wall.");
            } else {
                ki("No message posted on the 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-06-04T04:28:44+00:00Added an answer on June 4, 2026 at 4:28 am
    private void publishPhoto(String imageURL) {
        Log.d("FACEBOOK", "Post to Facebook!");
    
        try {
    
            JSONObject attachment = new JSONObject();
            attachment.put("message", Utils.s(R.string.fb_message));
            attachment.put("name", Utils.s(R.string.fb_name));
            attachment.put("href", Utils.s(R.string.url_dotzmag));
            attachment.put("description", Utils.s(R.string.fb_description));
    
            JSONObject media = new JSONObject();
            media.put("type", "image");
            media.put("src", imageURL);
            media.put("href", Utils.s(R.string.url_dotzmag));
            attachment.put("media", new JSONArray().put(media));
    
            JSONObject properties = new JSONObject();
    
            JSONObject prop1 = new JSONObject();
            prop1.put("text", "Dotz App on Android Market");
            prop1.put("href", Utils.s(R.string.url_android_market));
            properties.put("Get the App for free", prop1);
    
            JSONObject prop2 = new JSONObject();
            prop2.put("text", "Dotz Tuning on Facebook");
            prop2.put("href", Utils.s(R.string.url_facebook_fanpage));
            properties.put("Visit our fanpage", prop2);
    
            attachment.put("properties", properties);
    
            Log.d("FACEBOOK", attachment.toString());
    
            Bundle params = new Bundle();
            params.putString("attachment", attachment.toString());
            mFacebook.dialog(mActivity, "stream.publish", params, new PostPhotoDialogListener());
            //mAsyncRunner.request("me/feed", params, "POST", new WallPostRequestListener(), null);
    
        } catch (JSONException e) {
            Log.e("FACEBOOK", e.getLocalizedMessage(), e);
        }
    }
    public class PostPhotoDialogListener extends BaseDialogListener {
    
        public void onComplete(Bundle values) {
            final String postId = values.getString("post_id");
            if (postId != null) {
                Log.d("FACEBOOK", "Dialog Success! post_id=" + postId);
                Toast.makeText(mActivity, "Successfully shared on Facebook!", Toast.LENGTH_LONG).show();
                /*
                mAsyncRunner.request(postId, new WallPostRequestListener());
                mDeleteButton.setOnClickListener(new OnClickListener() {
                    public void onClick(View v) {
                        mAsyncRunner.request(postId, new Bundle(), "DELETE",
                                new WallPostDeleteListener(), null);
                    }
                });
                */
            } else {
                Log.d("FACEBOOK", "No wall post made");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Few months ago i made an app based on apple GLPaint. It works great.
I've made a little forum and I want parse the date on newest posts
Made this nice little loop for hiding and showing div's, works as a charm
I made a little site for car renting,but i dont understand very well javascript.
I made a little example of my problem here: http://peterbriers.be/test/float_html5.html As you can see,
I have a little problem... I have made an Android application which extends the
I have a little problem, I just made a menu with some asp:hyperlink structured
I'm having a question about recursive functions. I've made this little example program that
i made a fast example of my little problem. can anyone tell me why
I made a little Shooter game with two ships firing at each other. I

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.