开发者

Override LocationManager?

开发者 https://www.devze.com 2023-03-04 13:04 出处:网络
I\'d like to change the behaviour of LocationManager, but its constructor isn\'t visible, so Eclipse won\'t allow extending it.

I'd like to change the behaviour of LocationManager, but its constructor isn't visible, so Eclipse won't allow extending it.

Can it be done?

If so, how do I get around the above issue, and then, how do I 开发者_JAVA百科instantiate it? (Or have the system use it as the LocationManager?)

Thanks


Here's the source:

/**
 * @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;
}

Notice the comment. Use Context.getSystemService.

0

精彩评论

暂无评论...
验证码 换一张
取 消