0

我想更改 LocationManager 的行为,但它的构造函数不可见,因此 Eclipse 不允许扩展它。

可以做到吗?

如果是这样,我如何解决上述问题,然后,如何实例化它?(或者系统是否将其用作 LocationManager?)

谢谢

4

1 回答 1

1

这是来源:

/**
 * @hide - hide this constructor because it has a parameter
 * of type ILocationManager, which is a system private class. The
 * right way to create an instance of this class is using the 
 * factory Context.getSystemService.
 */
public LocationManager(ILocationManager service) {
    if (Config.LOGD) {
        Log.d(TAG, "Constructor: service = " + service);
    }
    mService = service;
}

注意评论。使用 Context.getSystemService。

于 2011-05-07T07:28:00.813 回答