In a subclass of WebView, I used to have this line in an overridden method of getTitle():
String title = super.getTitle();
It worked well in all versions of Android, until I got to test my app on an Android 4.1 phone, which gave me this warning on that super.getTitle() line:
12-20 21:38:27.467: W/webview_proxy(2537): java.lang.Throwable: Warning: A WebView method was called on thread 'WebViewCoreThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
So, I was thinking of working around this new decree by passing it through runOnUiThread():
Activity a = this.getActivity();
a.runOnUiThread(new Runnable() {
public void run() {
String title = super.getTitle();
}
});
But this code won't even compile because super no longer refers to WebView, but rather to Activity.
Any idea how How to super.getTitle() from the UI thread? (with the constraints described above, in the getTitle() of a subclass of WebView)