I'm a bit new to Android programming so bear with me if I'm not 100% correct on how i phrase my questions. I'm looking for an a way to stop and reload my Android webView. The webView takes the user to a a simple HTML link, which works. Now I want to implement stop, reload, forward, and back buttons for the webView. What I did for the back and forward functions was very simple-- I simply created an onKeyDown function to facilitate going forward and backward as shown below:
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack())
{
mWebView.goBack();
return true;
}
if((keyCode == KeyEvent.KEYCODE_FORWARD) && mWebView.canGoForward())
{
mWebView.goForward();
return true;
}
return super.onKeyDown(keyCode, event);
}
Now for reloading (refreshing) this webView and stopping this webView from loading is my trouble. I know for reloading a webView you could simply create a new setOnClickListener function and reload the URL. I'm not so sure about stopping a webView from loading. Do I have to create individual buttons for reloading/stopping the webView? Or is there a prebuilt function I can place inside my code that can help me do so? Any help would be appreciated! Thanks!