Example usage for android.webkit WebView loadUrl

List of usage examples for android.webkit WebView loadUrl

Introduction

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

Prototype

public void loadUrl(String url) 

Source Link

Document

Loads the given URL.

Usage

From source file:com.hhs.hfnavigator.slidingtabs.hhs.AboutFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();//from   ww w .  j a v a  2 s.c  o  m
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("http://www.harborfieldscsd.net/our_schools/harborfields_high_school");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.home.PollsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();//from   w  w w .  j a va 2  s  .co  m
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("https://docs.google.com/document/d/1Y8c9GwN0nkRBRHau1SCRrvAmRK1LQiV7Omn13KsMMqc/pub");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);
    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.hhs.LibFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();/*from   w w w  . ja v a  2s .c  om*/
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("https://hscsd.follettdestiny.com/common/welcome.jsp?context=saas30_3133764");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.tools.CastleFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();// www  .java  2 s .c  o m
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("http://www.castlelearning.com/mobile");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

    }
    return root;
}

From source file:com.hhs.hfnavigator.slidingtabs.tools.EdmodoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null);

    progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress);

    swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe);
    swipeRefreshLayout.setEnabled(false);
    progressWheel.spin();/*from  w w w .j  ava 2 s .  co m*/
    final WebView webView = (WebView) root.findViewById(R.id.webView);
    if (webView != null) {
        webView.setWebViewClient(new WebViewClient() {

            public void onPageFinished(WebView view, String url) {
                progressWheel.stopSpinning();
            }
        });
        webView.loadUrl("http://www.edmodo.com/m");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setDisplayZoomControls(false);

    }
    return root;
}

From source file:com.github.ajasmin.telususageandroidwidget.ReportAccountErrorActivity.java

private void setupWebView() {
    // Load cached usage report in the WebView
    WebView webview = (WebView) findViewById(R.id.web_view);
    try {// w ww . jav a 2  s .com
        URL url = getFileStreamPath("" + appWidgetId).toURL();
        webview.loadUrl(url.toString());
    } catch (MalformedURLException e) {
        throw new Error(e);
    }

    // Prevent links in the WebView from being used
    webview.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return true;
        }
    });
}

From source file:net.potterpcs.recipebook.HelpDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.helpdialog, container);
    WebView web = (WebView) v.findViewById(R.id.helpwebview);

    // All we have to do is give the WebView a location, and it does
    // all the work for us.
    if (helpFile != null) {
        String baseUrl = "file:///android_res/raw/";
        String url = baseUrl + helpFile + ".html";
        Log.v(TAG, url);/*from w ww . jav  a2 s . c om*/
        web.loadUrl(url);
    }

    return v;
}

From source file:piuk.blockchain.android.ui.WalletActivity.java

@Override
protected Dialog onCreateDialog(final int id) {
    final WebView webView = new WebView(this);
    if (id == DIALOG_HELP)
        webView.loadUrl("file:///android_asset/help" + languagePrefix() + ".html");

    final Dialog dialog = new Dialog(WalletActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(webView);/*from  ww w .j a  va 2 s .  c o m*/
    dialog.setCanceledOnTouchOutside(true);

    return dialog;
}

From source file:com.example.leebeomwoo.viewbody_final.ItemGroup.TrainerInfoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_trainer_info, container, false);
    final RecyclerView rvli = (RecyclerView) view.findViewById(R.id.license_list);
    rvli.setHasFixedSize(true);//  ww w. j av a 2  s.c  om
    LinearLayoutManager llmli = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    rvli.setLayoutManager(llmli);
    final RecyclerView rvaw = (RecyclerView) view.findViewById(R.id.award_list);
    rvaw.setHasFixedSize(true);
    LinearLayoutManager llmaw = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    rvaw.setLayoutManager(llmaw);
    Call<ResponseTr> call = ConAdapter.getInstance().TR_CALL(tr_id);
    call.enqueue(new Callback<ResponseTr>() {
        @Override
        public void onResponse(Call<ResponseTr> call, Response<ResponseTr> response) {
            responseTr = response.body();
            TextView asstxtB = (TextView) view.findViewById(R.id.trainer_association_txt);
            TextView nicktxtB = (TextView) view.findViewById(R.id.trainer_nicname_txt);
            TextView calltxtB = (TextView) view.findViewById(R.id.trainer_call_txt);
            TextView emailtxtB = (TextView) view.findViewById(R.id.trainer_email_txt);
            WebView faceWxb = (WebView) view.findViewById(R.id.trainer_facewebView);
            asstxtB.setText(responseTr.getAssociation());
            nicktxtB.setText(responseTr.getNickName());
            calltxtB.setText(responseTr.getCall());
            emailtxtB.setText(responseTr.getEmail());
            faceWxb.loadUrl(responseTr.getPhotoUrl());
            faceWxb.setFocusable(false);
            licenses = responseTr.getLicense();
            Trainer_license_Adapter adapterli = new Trainer_license_Adapter(getActivity(), licenses);
            rvli.setAdapter(adapterli);
            awards = responseTr.getAward();
            Trainer_award_Adapter adapteraw = new Trainer_award_Adapter(getActivity(), awards);
            rvaw.setAdapter(adapteraw);
        }

        @Override
        public void onFailure(Call<ResponseTr> call, Throwable t) {
            Toast toast = null;
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                toast = Toast.makeText(getContext(), "? ? ?.",
                        Toast.LENGTH_SHORT);
            }
            toast.show();
        }
    });
    return view;
}

From source file:com.ben.gank.fragment.WebFragment.java

private void initWebView() {
    mWebView.setWebViewClient(new WebViewClient() {
        @Override//  w  w w .  j a v a  2 s.c o m
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            //trueWebViewfalse??
            view.loadUrl(url);
            return true;
        }
    });
    mWebView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onProgressChanged(WebView view, int newProgress) {
            if (newProgress == 100) {
                // ?
                if (mProgressBar != null && mSwipeRefreshLayout != null) {
                    mProgressBar.setVisibility(View.GONE);
                    mProgressBar.setProgress(0);
                    mSwipeRefreshLayout.setRefreshing(false);
                }
            } else {
                // 
                if (mProgressBar != null) {
                    mProgressBar.setVisibility(View.VISIBLE);
                    mProgressBar.setProgress(newProgress);
                }
            }
        }
    });
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    mWebView.getSettings().setSupportZoom(true);
    mWebView.getSettings().setDisplayZoomControls(true);

}