简体   繁体   English

Android Studio Facebook:普通课程中的onActivityResult

[英]Android Studio Facebook: onActivityResult in normal class

In order to listen to a facebook login event I must override in my activity the function onActityResult and make a call to facebook's callbackmanager. 为了收听Facebook登录事件,我必须在我的活动中重写onActityResult函数,并调用Facebook的callbackmanager。

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    callbackManager.onActivityResult(requestCode, resultCode, data);
}

So far everything's working. 到目前为止,一切正常。

I'd like to create a static class for facebook that handles facebook callbacks, such as login, etc. 我想为Facebook创建一个静态类来处理Facebook回调,例如登录等。

Is there substitute for onActivityResult in that case? 在这种情况下,可以替代onActivityResult吗?

You mean you want another class to handle the activity returning? 您的意思是您想要另一个类来处理活动返回吗? Then you have to have onActivityResult of the activity that calls startActivityForResult call into your facebook class. 然后,您必须具有将startActivityForResult调用调用到Facebook类的活动的onActivityResult。 There's no way to reroute it automatically. 无法自动重新路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM