我登录Facebook时使用的是Facebook SDK 3.0,它比回到下一个活动返回登录屏幕,但我想直接进入下一个活动.
这是我的代码:
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 i = new Intent(MainActivity.this,Next.class); i.putExtra("BitmAPImage", profPict); startActivity(i); // lblEmail.setText(user.asMap().get("email").toString()); } } });}
和onActivityResult()
@OverrIDepublic voID onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);}
解决方法:
嘿,请在onActivityResult块中插入以下代码:
Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); if (Session.getActiveSession() != null || Session.getActiveSession().isOpened()){ Intent i = new Intent(MainActivity.this,Next.class); startActivity(i); }
这很好.
总结以上是内存溢出为你收集整理的在Android中登录Facebook SDK 3.0后如何直接进行下一步活动全部内容,希望文章能够帮你解决在Android中登录Facebook SDK 3.0后如何直接进行下一步活动所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)