Skip to content

Instantly share code, notes, and snippets.

@gmsetiawan
Created July 8, 2014 17:11
Show Gist options
  • Save gmsetiawan/075d622fbcd6da87e59e to your computer and use it in GitHub Desktop.
Save gmsetiawan/075d622fbcd6da87e59e to your computer and use it in GitHub Desktop.
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