com.facebook
Class UiLifecycleHelper

java.lang.Object
  extended by com.facebook.UiLifecycleHelper

public class UiLifecycleHelper
extends Object

This class helps to create, automatically open (if applicable), save, and restore the Active Session in a way that is similar to Android UI lifecycles.

When using this class, clients MUST call all the public methods from the respective methods in either an Activity or Fragment. Failure to call all the methods can result in improperly initialized or uninitialized Sessions.


Constructor Summary
UiLifecycleHelper(Activity activity, Session.StatusCallback callback)
          Creates a new UiLifecycleHelper.
 
Method Summary
 void onActivityResult(int requestCode, int resultCode, Intent data)
          To be called from an Activity or Fragment's onActivityResult method.
 void onCreate(Bundle savedInstanceState)
          To be called from an Activity or Fragment's onCreate method.
 void onDestroy()
          To be called from an Activity or Fragment's onDestroy method.
 void onPause()
          To be called from an Activity or Fragment's onPause method.
 void onResume()
          To be called from an Activity or Fragment's onResume method.
 void onSaveInstanceState(Bundle outState)
          To be called from an Activity or Fragment's onSaveInstanceState method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UiLifecycleHelper

public UiLifecycleHelper(Activity activity,
                         Session.StatusCallback callback)
Creates a new UiLifecycleHelper.

Parameters:
activity - the Activity associated with the helper. If calling from a Fragment, use Fragment.getActivity()
callback - the callback for Session status changes, can be null
Method Detail

onCreate

public void onCreate(Bundle savedInstanceState)
To be called from an Activity or Fragment's onCreate method.

Parameters:
savedInstanceState - the previously saved state

onResume

public void onResume()
To be called from an Activity or Fragment's onResume method.


onActivityResult

public void onActivityResult(int requestCode,
                             int resultCode,
                             Intent data)
To be called from an Activity or Fragment's onActivityResult method.

Parameters:
requestCode - the request code
resultCode - the result code
data - the result data

onSaveInstanceState

public void onSaveInstanceState(Bundle outState)
To be called from an Activity or Fragment's onSaveInstanceState method.

Parameters:
outState - the bundle to save state in

onPause

public void onPause()
To be called from an Activity or Fragment's onPause method.


onDestroy

public void onDestroy()
To be called from an Activity or Fragment's onDestroy method.