Code example for WebView: Displaying web pages

Methods: clearCachegetSettingsloadUrlsetWebViewClient

0
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
         
        webview = (WebView) findViewById(R.id.vkontakteview);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.clearCache(true);
         
        //Чтобы получать уведомления об окончании загрузки страницы 
        webview.setWebViewClient(new VkontakteWebViewClient());
                 
        //otherwise CookieManager will fall with java.lang.IllegalStateException: CookieSyncManager::createInstance() needs to be called before CookieSyncManager::getInstance() 
        CookieSyncManager.createInstance(this);
         
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.removeAllCookie();
         
        String url=Auth.getUrl(Constants.API_ID, Auth.getSettings());
        webview.loadUrl(url);
    } 
     
    class VkontakteWebViewClient extends WebViewClient {
        @Override 
        public void onPageStarted(WebView view, String url, Bitmap favicon) {