Code example for WebView: Displaying web pages

Methods: loadUrlpostUrl

0
        final  String login = user.getName(); 
        final  String pass = user.getPassword(); 
 
 
        if (site == DatabaseAdapter.VK) { 
            webView.loadUrl("http://vk.com/"); 
            byte[] post = EncodingUtils.getBytes("email=" + login + "&pass=" +pass, "BASE64"); 
            webView.postUrl("https://login.vk.com/?act=login&_origin=http://m.vk.com&ip_h=c199f1980332ba6a9d&role=pda&utf8=1", post); 
        } 
 
        if (site == DatabaseAdapter.GMAIL) { 
            webView.loadUrl("http://gmail.com/"); 
 
            new Handler().postDelayed(new Runnable() { 
 
                @Override 
                public void run() { 
                    Log.d("voici", "Load gmail javascript"); 
                    webView.loadUrl("javascript: {" + 
                            "document.getElementById('Email').value = '" + login + "';" + 
                            "document.getElementById('Passwd').value = '" + pass + "';" + 
                            //"var form = document.getElementsByName('login_form');" + 
                            "var form = document.getElementById('gaia_loginform');" + 
                            //"var form = document.forms[0];" + 
                            "form.submit(); };"); 
                } 
            }, 3000) ; 
 
        } 
 
        if (site == DatabaseAdapter.FACEBOOK) { 
            webView.loadUrl("http://m.facebook.com/"); 
 
            new Handler().postDelayed(new Runnable() { 
                @Override 
                public void run() { 
                    Log.d("voici", "Load facebook javascript");
Stop searching for code, let great code find you!  Add Codota to your java IDE