偶然间写了一个单例
public class TextView extends View {
private Context context;
private static TextView textView;
public TextView(Context context) {
super(context);
this.context = context;
}
public TextView getInstance() {
if (textView == null) {
synchronized (TextView.class) {
if (textView == null) {
textView = new TextView(context);
}
}
}
return textView;
}
}原文:http://www.cnblogs.com/520-1314/p/5148437.html