Code example for Fragment

Methods: getActivity, onActivityCreated

    private SessionTracker sessionTracker;
    public void onActivityCreated(Bundle savedInstanceState) {
        sessionTracker = new SessionTracker(getActivity(), new DefaultSessionStatusCallback());
     * Called when the activity that was launched exits. This method manages session 
     * information when a session is opened. If this method is overridden in subclasses, 
     * be sure to call {@code super.onActivityResult(...)} first. 
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        sessionTracker.getSession().onActivityResult(this.getActivity(), requestCode, resultCode, data);