android - Blank Screen during facebook login -


i using facebook login in application , working fine, problem when click login button, shows blank screen moment, want use own asynctask instead of facebook.

blank screen

here code.

ublic class sdloginactivity extends activity {  private static final string tag = sdloginactivity.class.getsimplename(); private imagebutton imgbtnfacebooklogin; private textview tvuserdetails; private int counter = 0;  private session.statuscallback statuscallback = new sessionstatuscallback();  // --------------------------------------------------------------------- @override public void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);     utilities.showtoast(sdloginactivity.this, "data == " + data);     session.getactivesession().onactivityresult(this, requestcode, resultcode, data); }  // --------------------------------------------------------------------- @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     logger.logger("inside " + tag);     setcontentview(r.layout.login_layout);     imgbtnfacebooklogin = (imagebutton) findviewbyid(r.id.btn_fb_login);     tvuserdetails = (textview) findviewbyid(r.id.tv_user_details);     settings.addloggingbehavior(loggingbehavior.include_access_tokens);     session session = session.getactivesession();     if (session == null) {         if (savedinstancestate != null) {             session = session.restoresession(this, null, statuscallback, savedinstancestate);         }         if (session == null) {             session = new session(this);         }         session.setactivesession(session);         if (session.getstate().equals(sessionstate.created_token_loaded)) {             session.openforread(new session.openrequest(this).setcallback(statuscallback));         }     }      imgbtnfacebooklogin.setonclicklistener(new onclicklistener() {         public void onclick(view view) {             tvuserdetails.settext("");             onclicklogin();           }     });      // updateview(session);  }  // ---------------------------------------------------------------------  private class sessionstatuscallback implements session.statuscallback {     @override     public void call(session session, sessionstate state, exception exception) {          if (session.isopened()) {             updateview(session);         }      } }  // --------------------------------------------------------------------- @override public void onstart() {     super.onstart();     session.getactivesession().addcallback(statuscallback); }  // --------------------------------------------------------------------- @override public void onstop() {     super.onstop();     session.getactivesession().removecallback(statuscallback); }  // --------------------------------------------------------------------- @override protected void onsaveinstancestate(bundle outstate) {     super.onsaveinstancestate(outstate);     session session = session.getactivesession();     session.savesession(session, outstate); }  // --------------------------------------------------------------------- private void updateview(session session) {     request.executemerequestasync(session, new request.graphusercallback() {         @override         public void oncompleted(graphuser user, response response) {             if (user != null) {                 logger.logger(tag, "======================user data===================" + user.tostring());                 logger.logger(tag, "strfbname=======" + user.getname());                 logger.logger(tag, "strprofileurl=======" + "https://graph.facebook.com/" + user.getid() + "/picture?type=large");                 logger.logger(tag, "user_gender=======" + user.getproperty("gender").tostring());                 logger.logger(tag, "strfbid=======" + user.getid());                 logger.logger(tag, "strfbname=======" + user.getname());                 logger.logger(tag, "strfbuid=======" + user.getid());                 logger.logger(tag, "strfblastname=======" + user.getlastname());                 logger.logger(tag, "==================================================");                 counter++;                 utilities.showtoast(sdloginactivity.this, "oncompleted called " + counter);                 tvuserdetails.settext(user.getname());                  utilities.startnewactivity(sdloginactivity.this, new intent(sdloginactivity.this, shareonfbactivity.class));             }         }     }); }  // --------------------------------------------------------------------- private void onclicklogin() {     session session = session.getactivesession();     if (!session.isopened() && !session.isclosed()) {          openmyactivesession(this, true, statuscallback, arrays.aslist("email", "status_update"));     } else {         session.openactivesession(this, true, statuscallback);     }  }  // --------------------------------------------------------------------- private static session openmyactivesession(activity activity, boolean allowloginui, statuscallback callback, list<string> permissions) {     openrequest openrequest = new openrequest(activity).setpermissions(permissions).setcallback(callback);     session session = new builder(activity).build();     if (sessionstate.created_token_loaded.equals(session.getstate()) || allowloginui) {         session.setactivesession(session);         session.openforread(openrequest);         return session;     }     return null; }  } 

you can set theme no display facbook login activity shown below in androidmanifest.xml

<activity android:name="com.facebook.loginactivity"            android:theme="@android:style/theme.nodisplay" /> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -