Hi,

I am trying to use facebook APIs in Android. For this I started with
the simple example on FB Developer's site. I am new to Java and
Android and unable to understand what this piece of code doing in
SessionEvents.java:

public class SessionEvents {

private static LinkedList<LogoutListener> mLogoutListeners = new
LinkedList<LogoutListener>();

public static void onLogoutBegin() {
            for (LogoutListener l : mLogoutListeners) {
                l.onLogoutBegin();
            }
        }

        public static interface LogoutListener {
            /**
             * Called when logout begins, before session is
invalidated. Last chance to make an API call. Executed by the thread
that initiated the logout.
             */
            public void onLogoutBegin();

            /**
             * Called when the session information has been cleared.
UI should be updated to reflect logged-out state. Executed by the
thread that initiated the logout.
             */
            public void onLogoutFinish();
        }

}
More info:
SessionEvents .onLogoutBegin() is called by a button's
OnClickListener() which is present in a calling class.

Isn't onLogoutBegin() a recursive function? I am wondering why would a
onClick call a recursive function to logout a user from (say)
facebook. Also is it a best practice to code like this?

Thanks,
Souvik

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to