/** Get the current user profile info */ private void makeMeRequest() { final Session session = Session.getActiveSession(); if (session != null && session.isOpened()) { Request request = Request.newMeRequest( session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { isMakeMeRequestStarted = false; dismissProgressDialog(); if (session == Session.getActiveSession() && user != null) { mUser = user; updateUI(); } if (response != null && response.getError() != null) { Utils.handleError( getActivity(), response.getError(), Utils.getProfileReadPermission()); } } }); request.executeAsync(); } }
@Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); final Session session = Session.getActiveSession(); if (mUser == null && !hidden && session != null && session.isOpened()) { if (!isMakeMeRequestStarted) { makeMeRequest(); isMakeMeRequestStarted = true; } if (!isStatusesRequestStarted) { startStatusesRequest(); isStatusesRequestStarted = true; } showProgressDialog(); } }
/** Get the user's status */ private void startStatusesRequest() { Session session = Session.getActiveSession(); if (session != null && session.isOpened()) { new Request( session, "/me/statuses", null, HttpMethod.GET, new Request.Callback() { public void onCompleted(Response response) { isStatusesRequestStarted = false; dismissProgressDialog(); handleStatusResponse(response); } }) .executeAsync(); } }