【Android】facebook api Exception: launchMode of the caller is singleInstance.

来源:互联网 发布:化合物毒性数据库 编辑:程序博客网 时间:2024/05/07 14:09

Cannot call LoginFragment with a null calling package. This can occur if the launchMode of the caller is singleInstance.

说的是不能使用单例模式,查看调用工具,发现如下代码:

        // the activity need attention , may use Login Master's Activity instead        LoginManager.getInstance().logInWithReadPermissions(activity, permissions);

这里的activity就是问题症结所在,因为这个工具写成了单例模式,需要在 instance 不为null时,也把activity设置一遍:

public static FacebookUtils getInstance(Activity activity) {    if (instance == null) {        instance = new FacebookUtils(activity);    }        this.activity = (Activity) activity;    return instance;}

这样设置之后问题就解决了。

have fun

转载署源-By-KyleCe:http://blog.csdn.net/KyleCeshen/article/details/50419414

0 0
原创粉丝点击