码迷,mamicode.com
首页 > 移动开发 > 详细

SFS2X Android 基础

时间:2017-05-27 10:53:02      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:create   bug   client   android   同步   class   null   nal   sync   

SmartFox对象在Activity中的传递无法使用Bundle,可以写一个SFSController类来解决,类中有一个私有静态SmartFox对象和一个公有静态线程同步的方法来传递SmartFox对象,因为静态方法和静态对象是全局统一的

import sfs2x.client.SmartFox;

/**
 * Created by wei on 2017/5/27.
 */

class SFSController {

    private final static boolean DEBUG_SFS = true;
    private static SmartFox sfsClientInstance;

    public static synchronized SmartFox getSFSClient()
    {
        if (sfsClientInstance == null)
        {
            sfsClientInstance = new SmartFox();
        }
        return sfsClientInstance;
    }
}

在所有的Activity中都不要去new SmartFox(),而是使用该类的静态方法。

SFS2X Android 基础

标签:create   bug   client   android   同步   class   null   nal   sync   

原文地址:http://www.cnblogs.com/mazing/p/6911216.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!