【发布时间】:2016-11-09 13:43:06
【问题描述】:
我正在尝试获取我的 Services 对象,我正在使用此代码进行此操作
public class Service extends android.app.Service {
private Handler handler = new Handler();
static Service SELF;
MainActivity mainActivity;
BluetoothSPP bluetoothSPP;
public static Service getInstance() {
return SELF;
}
@Override
public void onCreate() {
super.onCreate();
SELF = this;
}
}
但在启动服务后getInstance() 给出了 null。为什么?
【问题讨论】: