android单例模式

来源:互联网 发布:转换音乐格式的软件 编辑:程序博客网 时间:2024/05/16 14:07
懒汉模式:public class ImageUtil {    private static ImageUtil instance = null;    private ImageLoader mImageLoader;    private ImageUtil() {        mImageLoader = ImageLoader.getInstance();    }    public static synchronized ImageUtil getInstance() {        if (instance == null) {            instance = new ImageUtil();        }        return instance;    }

}



0 0
原创粉丝点击