Question

I keep getting this error:

Illegal modifier for the local class myWebClient; only abstract or final is permitted.

and this error:

void is an invalid type for the variable backButtonClicked

Heres the code where the error occurs.

public class myWebClient extends WebViewClient
{

}
public void backButtonClicked(View view)
{
    if (ourBrow.canGoBack())
    ourBrow.goBack();
}

public void forwardButtonClicked(View view)
{
    if (ourBrow.canGoForward())
    ourBrow.goForward();
}

public void goButtonClicked(View view)
{
    String theWebsite = Url.getText().toString();
    if(theWebsite != null)
    ourBrow.loadUrl(theWebsite);
}

public void refreshButtonClicked(View view)
{
    ourBrow.reload();
}
Was it helpful?

Solution

Remove the public modifier of the class and put all methods inside the body of the class:

class myWebClient extends WebViewClient
{

    public void backButtonClicked(View view)
    {
        if (ourBrow.canGoBack())
        ourBrow.goBack();
    }

    public void forwardButtonClicked(View view)
    {
        if (ourBrow.canGoForward())
        ourBrow.goForward();
    }

    public void goButtonClicked(View view)
    {
        String theWebsite = Url.getText().toString();
        if(theWebsite != null)
        ourBrow.loadUrl(theWebsite);
    }

    public void refreshButtonClicked(View view)
    {
        ourBrow.reload();
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top