Created
July 8, 2014 17:11
-
-
Save gmsetiawan/075d622fbcd6da87e59e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class PlaceholderFragment extends Fragment { | |
public PlaceholderFragment() { | |
} | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
View rootView = inflater.inflate(R.layout.fragment_main, container, false); | |
Session.openActiveSession(getActivity(), true, new Session.StatusCallback() { | |
@Override | |
public void call(Session session, SessionState state, Exception exception) { | |
// TODO Auto-generated method stub | |
if (session.isOpened()) { | |
Request.newMeRequest(session, new Request.GraphUserCallback() { | |
@Override | |
public void onCompleted( GraphUser user, Response response) { | |
// TODO Auto-generated method stub | |
if (user != null) { | |
TextView welcome = (TextView) getView().findViewById(R.id.welcome); | |
welcome.setText("Hello " + user.getName() + " " + user.getId() + "!"); | |
} | |
} | |
}).executeAsync(); | |
} | |
} | |
}); | |
return rootView; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment