缺少字符(此行有多个标记

时间:2012-08-29 13:42:35

标签: java android

您还熟悉Android和Java。

请看一下这段代码,我收到多个标记错误,无法找出错过字符或括号的位置。它表示最后两个括号的错误。

public class watsnuut extends Activity{      

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.watsnuut);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    WebView webView = (WebView) findViewById(R.id.webView2);
    final ProgressBar progess = (ProgressBar) findViewById(R.id.ProgressBar);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl("http://kyknet.dstv.com/nuus/");
    webView.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progess.setVisibility(View.VISIBLE);
        }
        public void onPageFinished(WebView view, String url) {
        progess.setVisibility(View.GONE);
        }



    }
  }

提前致谢

2 个答案:

答案 0 :(得分:1)

您没有关闭setWebViewClient方法调用

webView.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progess.setVisibility(View.VISIBLE);
        }
        public void onPageFinished(WebView view, String url) {
        progess.setVisibility(View.GONE);
        }

});

答案 1 :(得分:0)

您忘了在

中添加});
 webView.setWebViewClient(new WebViewClient() {
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                progess.setVisibility(View.VISIBLE);
            }
            public void onPageFinished(WebView view, String url) {
            progess.setVisibility(View.GONE);
            }
    });

而不是

webView.setWebViewClient(new WebViewClient() {
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progess.setVisibility(View.VISIBLE);
        }
        public void onPageFinished(WebView view, String url) {
        progess.setVisibility(View.GONE);
        }