Android Facebook Dialog

I have integrated Facebook into my app. However, instead of bringing it up in a dialog, it opens full screen. I was wondering if anyone would know of a way to change this to dialog.

FaceBook Handler Class:

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

    /*
     * Get existing access_token if any
     */      
    mPrefs = getPreferences(MODE_PRIVATE);
    String access_token = mPrefs.getString("access_token", null);
    long expires = mPrefs.getLong("access_expires", 0);

    if(access_token != null) 
        facebook.setAccessToken(access_token);

    if(expires != 0) 
        facebook.setAccessExpires(expires);


    if (facebook.isSessionValid()) 
      postFacebookMessage();

    else {
      facebook.authorize(this, new String[] {"publish_stream"}, new Facebook.DialogListener() {

        @Override
        public void onFacebookError(FacebookError e) {
            Toast.makeText(FacebookConnector.this, "Facebook error: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
        }

        @Override
        public void onError(DialogError e) {
            Toast.makeText(FacebookConnector.this, "Facebook dialog error: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
        }

            @Override
        public void onComplete(Bundle values) {
                postFacebookMessage();
            Toast.makeText(FacebookConnector.this, "Thank You For Sharing!", Toast.LENGTH_SHORT).show(); }

        @Override
        public void onCancel() {Toast.makeText(FacebookConnector.this, "Facebook authorization cancelled.", Toast.LENGTH_LONG).show();
        }
    });
    }
} 

private void postFacebookMessage() {

  AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
  Bundle params = new Bundle();
  params.putString("message", MSG);
  params.putString("picture", "http://meanwhileinwv.com/meanwhile.png");
  mAsyncRunner.request("me/feed", params, "POST", new FacebookPostListener(), null); }    

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

The code above produces the following result:

I would like it to be a dialog that the facebook window opens into. I have achieved this with my Twitter code:

Answers


Call authorization with additional parameter Facebook.FORCE_DIALOG_AUTH, like this:

facebook.authorize(this, new String[] {"publish_stream"}, Facebook.FORCE_DIALOG_AUTH, new Facebook.DialogListener() { ... });

Need Your Help

How can I modify sign-in page in Meteor Accounts-Entry package

html meteor accounts

how can I find the html and css files for the Meteor Accounts-Entry, specifically the sign-in page, so I can modify the way it looks?

install CPAN module ClearCase::CtCmd

perl cpan

I need to install the CPAN module ClearCase::CtCmd. I have downloaded the module CtCmd-1.09. After running the command perl Makefile.PL I am having the following errors:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.