login with facebook in android application -


possible duplicate:
on android, how switch activities programatically?

i have built android application allows user login facebook.for i've used faceboook-sdk package.here how login:

    mfacebook = new facebook(app_id);     masyncrunner = new asyncfacebookrunner(mfacebook);  if(issession()){             intent = new intent(getbasecontext(), com.splashscreen.multipleoptions.class);             startactivity(i);         }             else             {                 log.d(tag, "sessionnotvalid, relogin");                mfacebook.authorize(this, perms, new logindialoglistener());                } 

and logindialoglistener:

 private class logindialoglistener implements dialoglistener {           public void oncomplete(bundle values) {                 log.d(tag, "loginoncomplete");                 string token = mfacebook.getaccesstoken();                 long token_expires = mfacebook.getaccessexpires();                 log.d(tag, "accesstoken: " + token);                 log.d(tag, "accessexpires: " + token_expires);                 sharedprefs = preferencemanager                                 .getdefaultsharedpreferences(getbasecontext());                 sharedprefs.edit().putlong("access_expires", token_expires)                                 .commit();                 sharedprefs.edit().putstring("access_token", token).commit();                 //masyncrunner.request("me", new idrequestlistener());          }           public void onfacebookerror(facebookerror e) {                 log.d(tag, "facebookerror: " + e.getmessage());         }           public void onerror(dialogerror e) {                 log.d(tag, "error: " + e.getmessage());         }           public void oncancel() {                 log.d(tag, "oncancel");         } } 

what wanna is-once try login , if login succesfully move automaticaly activity. in moment after succesfully log in stay on same activity.how do that???

to detect successfull login can use authlistener, e.g.

sessionevents.addauthlistener(new facebookauthlistener());  public class facebookauthlistener implements authlistener {      public void onauthsucceed() {         //... add code switch activity here...     } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -