Simple question, how do i call a function/method from inside shouldOverrideUrlLoading? I am searching for something like Qt's Signal and Slots so that i can get around that OO-Can-Not-See-Your-Parent-Jail. Using a static is sadly not an option as then i can not access the UI from that static anymore. And setting up the UI elements i want to access as statics wont work either as the Android API changes these around all the time, invalidating the static representations.
Thats what i have right now:
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView wv = (WebView) this.findViewById(R.id.webView);
wv.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView wv, String url)
{
//TODO: Call doUrlHandling somehow...
//wv.loadData("URL:" + url, "text/html", "UTF-8");
return true;
}
});
wv.loadUrl("file:///android_asset/startup.html");
}
public void doUrlHandling(String url)
{ }
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}