摘要:
简单工厂模式 工厂方法模式可以缩小为简单工厂模式(静态工厂模式)。 工厂方法模式: 简单工厂模式: 去掉了一个抽象的工厂类。而且一般情况下简单工厂类的create()方法是静态方法。 举个与工厂方法模式相同的例子: package com.test.mode; public abstract class Phone { public Phone(){ System.out.println("this is a Phone"); } public abstract void ring(); public abstract void inComingP... 阅读全文
摘要:
创建型模式之工厂方法模式 定义:Define an interface for creating an object,but let subclasses decide which class to instantiate . Factory Method lets a class defer instantiation to subclasses . 定义一个用于创建对象的借口,让子类决定实例化哪一个类。工厂方法使一个类的实例化延迟到其子类。 例子:现有手机,手机分为:IPhone,Android Phone两种,使用工厂方法模式,实现产生手机对象。 工厂: public... 阅读全文
摘要:
Introduced in Android 3.0, loaders make it easy to asynchronously load data in an activity or fragment. Loaders have these characteristics:They are available to everyActivityandFragment.They provide asynchronous loading of data.They monitor the source of their data and deliver new results when the c 阅读全文