Can someone give one exact example of webview implementation in android

Here you go:

    LinearLayout root = new LinearLayout(this);
root.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

WebView wv = new WebView(this);
wv.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); 
wv.getSettings().setJavaScriptEnabled(true); 

wv.loadUrl("http://www.google.com");
root.addView(wv);

setContentView(root);

Put this code in your onCreate-Method. And don't forget to set the Permission Internet in Android Manifest.


Android WebView loadurl example

Android WebView Example

WebView used to show webpages in our app. Let's make a WebView and load any website

provide permission in AndroidManifest.XML

<uses-permission android:name="android.permission.INTERNET"/>

activity_main.xml

 <?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

MainActivity.Java

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity
{
private WebView webview;

@Override
protected void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

webview=(WebView)findViewById(R.id.webview);
//loads androidride homepage to webview
webview.loadUrl("https://www.androidride.com");
}
}

Your Java file should be like this:

public class WebViewSampleActivity extends Activity {
     WebView wb;
    private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;
        }
    }
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);      
        wb=(WebView)findViewById(R.id.webView1);        
        wb.getSettings().setJavaScriptEnabled(true);
        wb.getSettings().setLoadWithOverviewMode(true);
        wb.getSettings().setUseWideViewPort(true);
        wb.getSettings().setBuiltInZoomControls(true);
        wb.getSettings().setPluginState(WebSettings.PluginState.ON);
        wb.getSettings().setPluginsEnabled(true);           
        wb.setWebViewClient(new HelloWebViewClient());
        wb.loadUrl("http://www.examplefoo.com");        
    }
}

Your xml file should be like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" 
    android:layout_gravity="center">

    <WebView
        android:id="@+id/webView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center" />

</LinearLayout>

Use the following in your manifest after <uses-sdk><uses-sdk/>:

 <uses-permission android:name="android.permission.INTERNET"/>