I am building an android app and I have a warning that is not causing any problems however, when I see a warning I like to at least know what is causing it. The app uses webview.
Here is the bit if code that is causing the warning.
ImageView viewSplash;
WebView mWebView;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
viewSplash = (ImageView) findViewById(R.id.splash);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setGeolocationEnabled(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebViewClient(new WebViewtest(){
@Override
public void onPageFinished(WebView View, String url)
{
viewSplash.setVisibility(View.GONE);
}
});
}
This is the error:
The static field View.GONE should be accessed in a static way.
Well, I can see one problem which might be relevant. You have a capitalised View as an argument name (see
public void onPageFinished(WebView -> View <-, String url)). Uncapitalise this.Edit: the problem was the argument name being the wrong caps, and masking the class access with an instance variable access, which is why you got the error. The better fix would be to sort out the capitalisation.