How to go Next Activity directly after Login in facebook SDK 3.0 in android -
i using facebook sdk 3.0 when login facebook come login screen go next activity want go directly next activity.
this code :-
if (session.isopened()) { token = session.getaccesstoken(); log.i("tag", "access token" + token); request.executemerequestasync(session,new request.graphusercallback() { @override public void oncompleted(graphuser user, response response) { if (user != null) { id = user.getid(); log.i("tag", "user id " + user.getid()); log.i("tag", "email "+ user.asmap().get("email")); try { url image_value = new url("http://graph.facebook.com/"+id+"/picture?type=large" ); profpict=bitmapfactory.decodestream(image_value.openconnection().getinputstream()); } catch (malformedurlexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } //http://graph.facebook.com/4/picture intent = new intent(mainactivity.this,next.class); i.putextra("bitmapimage", profpict); startactivity(i); // lblemail.settext(user.asmap().get("email").tostring()); } } }); }
and onactivityresult()
@override public void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); session.getactivesession().onactivityresult(this, requestcode, resultcode, data);}
hey please instert following code in onactivityresult block:
session.getactivesession().onactivityresult(this, requestcode, resultcode, data); if (session.getactivesession() != null || session.getactivesession().isopened()){ intent = new intent(mainactivity.this,next.class); startactivity(i); }
this works fine.
Comments
Post a Comment