List of usage examples for android.webkit WebView loadUrl
public void loadUrl(String url)
From source file:piuk.blockchain.android.ui.SendCoinsActivity.java
@Override protected Dialog onCreateDialog(final int id) { final WebView webView = new WebView(this); webView.loadUrl("file:///android_asset/help_send_coins" + languagePrefix() + ".html"); final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(webView);/* w w w .j a v a2 s . c o m*/ dialog.setCanceledOnTouchOutside(true); return dialog; }
From source file:com.rstar.mobile.thermocouple.ui.InfoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_info, parent, false); WebView webView = (WebView) v.findViewById(R.id.fragmentInfo_webView); try {//from ww w . j a va2 s . c o m Uri path = Uri.parse("file:///android_asset/" + ThermoCouple.getFactFilename(mTypeCode)); webView.loadUrl(path.toString()); } catch (Exception e) { } return v; }
From source file:com.rstar.mobile.thermocouple.ui.DatabaseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_info, parent, false); getActivity().setTitle(title);//from w w w . j av a 2 s .c om WebView webView = (WebView) v.findViewById(R.id.fragmentInfo_webView); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); try { webView.loadUrl(AppSettings.databaseLink); } catch (Exception e) { } return v; }
From source file:com.elekso.potfix.fragment.LicenseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_license, container, false); WebView heroespage = (WebView) rootView.findViewById(R.id.webView_license); WebSettings webSettings = heroespage.getSettings(); webSettings.setJavaScriptEnabled(true); heroespage.loadUrl("file:///android_asset/license.html"); // return inflater.inflate(R.layout.fragment_license, container, false); return rootView; }
From source file:mmpud.project.daycountwidget.DayCountMainActivity.java
private void showLicensesAlertDialog() { WebView view = (WebView) LayoutInflater.from(this).inflate(R.layout.dialog_licenses, null); view.loadUrl("file:///android_asset/open_source_licenses.html"); new AlertDialog.Builder(this).setTitle("Open Source Licenses").setView(view) .setPositiveButton(android.R.string.ok, null).show(); }
From source file:de.uni_weimar.m18.anatomiederstadt.element.LatexFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_latex, container, false); WebView latexView = (WebView) root.findViewById(R.id.latexWebView); latexView.getSettings().setJavaScriptEnabled(true); latexView.getSettings().setBuiltInZoomControls(false); TypedValue typedValue = new TypedValue(); Resources.Theme theme = getActivity().getTheme(); theme.resolveAttribute(R.color.windowBackgroundColor, typedValue, true); latexView.setBackgroundColor(typedValue.data); latexView.loadDataWithBaseURL("http://bar", "<script type='text/x-mathjax-config'>" + "MathJax.Hub.Config({ " + "messageStyle: 'none'," + "showMathMenu: false, " + "jax: ['input/TeX','output/HTML-CSS'], " + "extensions: ['tex2jax.js'], " + "TeX: { extensions: ['AMSmath.js','AMSsymbols.js'," + "'noErrors.js','noUndefined.js'] } " + "});</script>" + "<script type='text/javascript' " + "src='file:///android_asset/MathJax/MathJax.js'" + "></script><span id='math'></span>", "text/html", "utf-8", ""); Log.v(LOG_TAG, "Loading latexCode: " + mLatexCode); latexView.setWebViewClient(new WebViewClient() { private String mLatexCode = null; @Override//from ww w .java 2 s .com public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (Build.VERSION.SDK_INT < 19) { view.loadUrl("javascript:document.getElementById('math').innerHTML='\\\\[" + doubleEscapeTeX(getLatexCode()) + "\\\\]'"); view.loadUrl("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);"); } else { view.evaluateJavascript("javascript:document.getElementById('math').innerHTML='\\\\[" + doubleEscapeTeX(getLatexCode()) + "\\\\]'", null); view.evaluateJavascript("javascript:MathJax.Hub.Queue(['Typeset',MathJax.Hub]);", null); } } }); return root; }
From source file:com.paulshantanu.bputapp.PdfViewerAcitvity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_settings: return true; case R.id.about: AlertDialog.Builder b = new AlertDialog.Builder(this); b.setTitle("About"); WebView about_view = new WebView(this); about_view.loadUrl("file:///android_asset/about.htm"); b.setView(about_view);//from www. j av a2s . c om b.setPositiveButton("OK", null); b.create().show(); return true; case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_next: webView.loadUrl("javascript:onNextPage()"); return super.onOptionsItemSelected(item); case R.id.action_previous: webView.loadUrl("javascript:onPrevPage()"); return super.onOptionsItemSelected(item); default: return super.onOptionsItemSelected(item); } }
From source file:io.github.hidroh.materialistic.ComposeActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.menu_send) { if (mEditText.length() == 0) { Toast.makeText(this, R.string.comment_required, Toast.LENGTH_SHORT).show(); return false; } else {//from w w w. j a va2 s . co m send(); return true; } } if (item.getItemId() == R.id.menu_quote) { mEditText.getEditableText().insert(0, createQuote()); } if (item.getItemId() == android.R.id.home) { onBackPressed(); return true; } if (item.getItemId() == R.id.menu_save_draft) { Preferences.saveDraft(this, mParentId, mEditText.getText().toString()); return true; } if (item.getItemId() == R.id.menu_discard_draft) { Preferences.deleteDraft(this, mParentId); return true; } if (item.getItemId() == R.id.menu_guidelines) { WebView webView = new WebView(ComposeActivity.this); webView.loadUrl(HN_FORMAT_DOC_URL); mAlertDialogBuilder.init(ComposeActivity.this).setView(webView) .setPositiveButton(android.R.string.ok, null).show(); return true; } return super.onOptionsItemSelected(item); }
From source file:org.namelessrom.devicecontrol.about.LicenseFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_webview, container, false); final WebView wv = (WebView) view.findViewById(R.id.dialog_help_webview); wv.getSettings().setTextZoom(90);// ww w . j a v a2s . c o m final String url = Application.get().isDarkTheme() ? "file:///android_asset/license_dark.html" : "file:///android_asset/license.html"; wv.loadUrl(url); return view; }
From source file:org.namelessrom.devicecontrol.about.PrivacyFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_webview, container, false); final WebView wv = (WebView) view.findViewById(R.id.dialog_help_webview); wv.getSettings().setTextZoom(90);//from w w w. ja v a 2 s . c o m final String url = Application.get().isDarkTheme() ? "file:///android_asset/privacy_dark.html" : "file:///android_asset/privacy.html"; wv.loadUrl(url); return view; }