/**
  * Instantiate the facebook session
  *
  * @param APP_ID
  * @param context
  * @return
  */
 public static Facebook instantiateSession(String APP_ID, Context context) {
   Facebook facebook = new Facebook(APP_ID);
   restore(facebook, context);
   SessionListener listener = new SessionListener(context);
   FacebookSessionEvents.addAuthListener(listener);
   FacebookSessionEvents.addLogoutListener(listener);
   return facebook;
 }
 /**
  * Request the logout for the current facebook session
  *
  * @param activity
  */
 public static void logoutRequest(Activity activity) {
   Facebook mFb = FacebookProvider.getFacebook();
   if (mFb.isSessionValid()) {
     FacebookSessionEvents.onLogoutBegin();
     AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(mFb);
     asyncRunner.logout(activity, new LogoutRequestListener(activity));
   }
 }
 @Override
 public void onCancel() {
   FacebookSessionEvents.onLoginError(context.getString(R.string.share_facbook_action_canceled));
 }
 @Override
 public void onError(DialogError error) {
   GuiUtils.error(TAG, null, new RuntimeException(error), context);
   FacebookSessionEvents.onLoginError(error.getMessage());
 }
 @Override
 public void onFacebookError(FacebookError error) {
   GuiUtils.error(TAG, null, error, context);
   FacebookSessionEvents.onLoginError(error.getMessage());
 }
 @Override
 public void onComplete(Bundle values) {
   FacebookSessionEvents.onLoginSuccess();
   GuiUtils.info(R.string.share_facebook_success_setup_message);
 }