There is a non public api that I need to override in order to workaround a quirk with Android's WebView.
The api is hidden but it is public:
/**
* ...
*
* @hide pending API council approval
*/
public boolean selectText() {
...
}
So I can override it by simply declaring it in my own WebView class, minus the @Override:
public boolean selectText() {
...
}
Is it possible to call the super method from my override? Normally I could write:
public boolean selectText() {
return super.selectText();
}
But the method is hidden, so super.selectText()
is not available. If I use reflection:
public boolean selectText() {
return (Boolean) WebView.class.getMethod("selectText").invoke(this, (Object[]) null);
}
I get an infinite loop because it calls my overridden method.
Is there anyway to override this method AND be able to call the super method?
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…