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!
No, unfortunately, as is explained in the answer to the question How to call a superclass method using Java reflection you cannot solve this problem with reflection.