Code example for WebView: Displaying web pages

Methods: addJavascriptInterfaceclearCachegetSettingsloadUrlsetWebViewClient

0
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mWebView = (WebView)findViewById(R.id.webView1);
        //자바 스크립트 실행 가능 
         
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.clearCache(true);
        mWebView.getSettings().setAppCacheEnabled(false);
         
        //mWebView.getSettings().setAllowContentAccess(true); 
        //mWebView.getSettings().setSupportMultipleWindows(true); 
         
        //바로 콜이 안되서 자바 스크립트 인터페이스 활용 
        mWebView.addJavascriptInterface(new CallMySpace(), "CallMySpace");
         
        // 서비스 홈페이지 지정 
        mWebView.loadUrl("http://211.43.193.17");
         
        // WebViewClient 지정 
        mWebView.setWebViewClient(new WebViewClientClass());  
    } 
     
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present. 
Stop searching for code, let great code find you!  Add Codota to your java IDE