Android中Application创建单例对象
2018-06-19 本文已影响65人
程序猿的小生活
public class MyApplication extends Application {
private static MyApplication app;
public static MyApplication getInstance() {
return app;
}
@Override
public void onCreate() {
super.onCreate();
app = this;
}
}