Example usage for android.webkit WebView WebView

List of usage examples for android.webkit WebView WebView

Introduction

In this page you can find the example usage for android.webkit WebView WebView.

Prototype

public WebView(Context context) 

Source Link

Document

Constructs a new WebView with an Activity Context object.

Usage

From source file:local.maciejkrysztofiak.stackviewer.WebViewFragment.java

/**
 * Called to instantiate the view. Creates and returns the WebView.
 *///  w w  w.j  a v a  2s . c  o  m
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }
    mWebView = new WebView(getActivity());
    mIsWebViewAvailable = true;
    mWebView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;
        }
    });
    mWebView.loadUrl(getArguments().getString(ResultsActivity.EXTRA_URL));
    return mWebView;
}

From source file:com.luorrak.ouroboros.miscellaneous.OpenSourceLicenseFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Util.onActivityCreateSetTheme(getActivity(), SettingsHelper.getTheme(getActivity()));
    super.onCreateView(inflater, container, savedInstanceState);

    getActivity().setTitle("License");
    WebView webView = new WebView(getActivity());
    AssetManager am = getActivity().getAssets();
    webView.loadUrl("file:///android_asset/license.html");

    return webView;
}

From source file:com.bidyut.app.wwquakes.SupportWebViewFragment.java

/**
 * Called to instantiate the view. Creates and returns the WebView.
 *//*from www  . j  a  v a2s.com*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }
    mWebView = new WebView(getActivity());
    mIsWebViewAvailable = true;
    return mWebView;
}

From source file:at.alladin.rmbt.android.util.RMBTTermsFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {

    activity = getActivity();/*from w ww.j a  va  2s.co  m*/

    webview = new WebView(activity);

    /* JavaScript must be enabled if you want it to work, obviously */
    // webview.getSettings().setJavaScriptEnabled(true);

    webview.getSettings().setSupportZoom(true);
    webview.getSettings().setBuiltInZoomControls(true);

    webview.setWebViewClient(new WebViewClient() {
        @Override
        public void onReceivedError(final WebView view, final int errorCode, final String description,
                final String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);
            webview.loadUrl("file:///android_res/raw/error.html");
        }
    });

    webview.loadUrl(this.getString(R.string.url_terms));

    return webview;
}

From source file:com.commonsware.android.webbeam.WebViewFragment.java

/**
 * Called to instantiate the view. Creates and returns the WebView.
 *///  ww  w. jav  a2  s.c o m
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }
    mWebView = new WebView(getContext());
    mIsWebViewAvailable = true;
    return mWebView;
}

From source file:it.gaiacri.mobile.AboutAttivita.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LinearLayout v = (LinearLayout) inflater.inflate(R.layout.activity_about, container, false);

    ((TextView) v.findViewById(R.id.about_title)).setText("Gaia Mobile v " + getString(R.string.app_version));

    GaiaGoogleAnalytics.notifyScreen(getActivity().getApplicationContext(), "About");

    //licenza//from   www . j  a v  a  2  s .c om
    ((TextView) v.findViewById(R.id.about_licenza))
            .setText(Html.fromHtml("Questa applicazione  rilasciata con licenza <a href=\"\">GPL v3</a>"));
    ((TextView) v.findViewById(R.id.about_licenza)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            AlertDialog.Builder alert = new AlertDialog.Builder(AboutAttivita.this.getActivity());
            WebView wv = new WebView(AboutAttivita.this.getActivity());
            wv.loadUrl("https://raw.githubusercontent.com/CroceRossaItaliana/gaia-android/master/LICENSE.txt");
            wv.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    view.loadUrl(url);

                    return true;
                }
            });
            alert.setView(wv);
            alert.setNegativeButton("Chiudi", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });
            alert.show();
        }
    });
    //portale gaia
    ((TextView) v.findViewById(R.id.about_portale_gaia))
            .setText(Html.fromHtml("<a href=\"\">Portale Gaia</a>"));
    ((TextView) v.findViewById(R.id.about_portale_gaia)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://gaia.cri.it");
        }
    });
    //informazioni gaia
    ((TextView) v.findViewById(R.id.about_gaia)).setText(Html.fromHtml("<a href=\"\">Informazioni GAIA</a>"));
    ((TextView) v.findViewById(R.id.about_gaia)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://gaia.cri.it/?p=public.about");
        }
    });
    //portale sviluppo mobile
    ((TextView) v.findViewById(R.id.about_gaia_mobile))
            .setText(Html.fromHtml("<a href=\"\">Codice Sorgente Gaia Mobile</a>"));
    ((TextView) v.findViewById(R.id.about_gaia_mobile)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://github.com/CroceRossaItaliana/gaia-android");
        }
    });
    //infomrazione dati
    ((TextView) v.findViewById(R.id.about_gaia_privacy))
            .setText(Html.fromHtml("<a href=\"\">Informazioni Gestione Dati</a>"));
    ((TextView) v.findViewById(R.id.about_gaia_privacy)).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Internet("https://gaia.cri.it/?p=public.privacy");
        }
    });

    //((WebView)v.findViewById(R.id.about_info))//.setClickable(true);;   
    return v;
}

From source file:com.dgsd.android.ShiftTracker.LicensesActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getSupportActionBar().setTitle(R.string.licenses);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setIcon(R.drawable.ic_launcher);

    WebView wv = new WebView(this);
    wv.loadUrl("file:///android_asset/about.html");

    setContentView(wv);/*from w ww.j av a2  s.  co m*/
}

From source file:jlelse.simplewebwrapper.SimpleWebWrapperActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // FAB//from  ww  w  . j a  va  2 s  .c o m
    enableFabChanges();

    //WebView
    webView = new WebView(this);
    WebSettings webSettings = webView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setAppCacheEnabled(true);
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (isOnlyOwnPagesAllowed()) {
                if (Uri.parse(url).getHost().equals(Uri.parse(getStartUrl()).getHost())) {
                    loadUrl(url);
                    return false;
                }
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                startActivity(intent);
                return true;
            } else {
                return false;
            }
        }

        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
            handler.proceed();
        }
    });
    addContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
}

From source file:com.arthackday.killerapp.fragments.WebViewFragment.java

/**
 * Called to instantiate the view. Creates and returns the
 * WebView./*from   w  w  w  . j  a v  a  2  s  .co m*/
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }

    mWebView = new WebView(getActivity());
    mIsWebViewAvailable = true;
    return mWebView;
}

From source file:com.hua.nowid.activity.WebViewFragment.java

/**
* Called to instantiate the view. Creates and returns the WebView.
*///from w w  w  .  j a va2s  .c  o m
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }
    parentVG = container;
    mWebView = new WebView(getActivity());
    mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    mWebView.setVerticalScrollBarEnabled(true);
    mIsWebViewAvailable = true;
    updateSecureCookie();

    return mWebView;
}