0
Session.openActiveSession(MainActivity.this, true, permissions,
new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
Request.newMeRequest(session,
new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != null) {
TextView welcome = (TextView) findViewById(R.id.textView1);
welcome.setText("Hello "
+ user.getName() + "!");
}
}
}).executeAsync();
// make request to the /me API
// when i add this code, it's crash
new Request(session, "/me", null,
HttpMethod.GET, new Request.Callback() {
public void onCompleted(
Response response) {
Toast.makeText(
getApplicationContext(),
response.getGraphObjectList()
.size()
+ "",
Toast.LENGTH_SHORT).show();
}
});
Request.executeMeRequestAsync(session, null);
}
}
});
崩溃?你有堆栈跟踪吗? – WizKid 2014-10-02 20:40:38