load Url using WebView - Android User Interface

Android examples for User Interface:WebView URL

Description

load Url using WebView

Demo Code


//package com.java2s;
import android.annotation.SuppressLint;

import android.content.Context;

import android.webkit.WebSettings;

import android.webkit.WebView;
import android.webkit.WebViewClient;

public class Main {
    @SuppressLint("SetJavaScriptEnabled")
    public static void loadUrl(Context mContext, WebView webview,
            String url, boolean javaScriptEnabled) {
        WebSettings webSettings = webview.getSettings();
        webSettings.setJavaScriptEnabled(javaScriptEnabled);
        webview.setWebViewClient(new WebViewClient());
        webview.loadUrl(url);/*w  w  w.j ava2 s  . c  o  m*/
    }
}

Related Tutorials