2011-05-07 28 views
0

我想改變LocationManager的行爲,但它的構造函數是不可見的,所以Eclipse不允許擴展它。覆蓋LocationManager?

可以這樣做嗎?

如果是這樣,我如何解決上述問題,然後,我如何實例化它? (?或者讓系統使用它作爲的LocationManager)

感謝

回答

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。