private void logintofb() {
Utils.showToast("in method", ctx);
mPrefs = getPreferences(MODE_PRIVATE);
String access_token = mPrefs.getString("access_token", null);
long expires = mPrefs.getLong("access_expires", 0);
if (access_token != null) {
fb.setAccessToken(access_token);
}
if (expires != 0) {
fb.setAccessExpires(expires);
}
if (!fb.isSessionValid()) {
fb.authorize(this,
// new String[] { "email", "publish_stream" },new DialogListener() {
new String[] { "email" ,"read_stream"}, new DialogListener() {
@Override
public void onFacebookError(FacebookError e) {
// TODO Auto-generated method stub
}
@Override
public void onError(DialogError e) {
// TODO Auto-generated method stub
}
@Override
public void onComplete(Bundle values) {
// values.get
final RequestAsyncTask me;
SharedPreferences.Editor editor = mPrefs.edit();
editor.putString("access_token",
fb.getAccessToken());
editor.putLong("access_expires",
fb.getAccessExpires());
editor.commit();
Session s=Session.getActiveSession();
// getprofilinfo();
// editor.
// loginToFacebook();
// SplashScreen.setStepOneComplete(1);
// Session sss=opena
me=Request.newMeRequest(s, new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
System.out.println("RESPONSEsdf>>>>>>>>>>>>>"+response);
if (user != null) {//HERE USER IS ALWAYS NULL GraphUser user
System.out.println("RESPONSE>>>>>>>>>>>>>"+response);
System.out.println(user.getName());
System.out.println(user.getBirthday());
System.out.println(user.getFirstName());
System.out.println(user.getLastName());
System.out.println(user.getLink());
System.out.println(user.getUsername());
System.out.println(user.getLocation());
System.out.println("facebook user id" + user.getId());
System.out.println(user.asMap().get("email").toString());
// Bundle params = me.getParameters();
// params.putString("fields", "email,name");
// me.setParameters(params);
// me.executeAsync();
}
}
}).executeAsync();
Intent i = new Intent(SignUp_activity.this,
MainscreenForChat.class);
startActivity(i);
finish();
}
此方法是通过简单的ImageButton点击事件调用的。
但是用户总是把我归还给我......
请帮助!!!!!