当前位置: 首页>>代码示例>>Java>>正文


Java WebView.restoreState方法代码示例

本文整理汇总了Java中android.webkit.WebView.restoreState方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.restoreState方法的具体用法?Java WebView.restoreState怎么用?Java WebView.restoreState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.restoreState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    destroyWebView();

    mWebView = new WebView(getActivity());
    mWebView.setWebViewClient(mWebViewClient);
    mWebView.getSettings().setJavaScriptEnabled(true);

    if (savedInstanceState == null) {
        mWebView.loadUrl(mUrl);
    } else {
        mWebView.restoreState(savedInstanceState);
    }

    mIsWebViewAvailable = true;
    return mWebView;
}
 
开发者ID:fivef,项目名称:add_to_evernote_note,代码行数:19,代码来源:EvernoteOAuthActivity.java

示例2: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  setContentView(R.layout.help);

  webView = (WebView) findViewById(R.id.help_contents);

  if (icicle == null) {
    webView.loadUrl(BASE_URL + "index.html");
  } else {
    webView.restoreState(icicle);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:14,代码来源:HelpActivity.java

示例3: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  setContentView(R.layout.help);

  webView = (WebView)findViewById(R.id.help_contents);
  webView.setWebViewClient(new HelpClient(this));

  Intent intent = getIntent();
  String page = intent.getStringExtra(REQUESTED_PAGE_KEY);

  // Show an OK button.
  View doneButton = findViewById(R.id.done_button);
  doneButton.setOnClickListener(doneListener);

  if (page.equals(DEFAULT_PAGE)) {
    doneButton.setVisibility(View.VISIBLE);
  } else {
    doneButton.setVisibility(View.GONE);
  }

  // Froyo has a bug with calling onCreate() twice in a row, which causes the What's New page
  // that's auto-loaded on first run to appear blank. As a workaround we only call restoreState()
  // if a valid URL was loaded at the time the previous activity was torn down.
  if (icicle != null && icicle.getBoolean(WEBVIEW_STATE_PRESENT, false)) {
    webView.restoreState(icicle);
  } else if (intent != null && page != null && page.length() > 0) {
    webView.loadUrl(BASE_URL + page);
  } else {
    webView.loadUrl(BASE_URL + DEFAULT_PAGE);
  }
}
 
开发者ID:mercuriete,项目名称:android-mrz-reader,代码行数:33,代码来源:HelpActivity.java

示例4: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Context of this activity
    mContext = this;

    // Get main WebView component
    mWebView = (WebView) findViewById(R.id.wv_main);

    // Get ProgressBar component
    mProgress = (ProgressBar) findViewById(R.id.pb_loading);

    // Attach clients to mWebView to measure progress and errors
    mWebView.setWebViewClient(new WebClient());
    mWebView.setWebChromeClient(new ChromeClient());

    // Get settings for mWebView
    WebSettings settings = mWebView.getSettings();
    // The two lines below are to enable interpreting <meta viewport> tag.
    settings.setUseWideViewPort(true);
    settings.setLoadWithOverviewMode(true);
    // Enable JavaScript
    settings.setJavaScriptEnabled(true);

    // Load AdBlocker
    mAdBlocker = new AdBlocker(this);
    mAdBlocker.execute();

    // Load MangaFox
    if (savedInstanceState != null) {
        mWebView.restoreState(savedInstanceState);
    } else {
        mWebView.loadUrl(MANGAFOX_URL);
    }
}
 
开发者ID:dipu-bd,项目名称:mangafox,代码行数:38,代码来源:MainActivity.java

示例5: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    setContentView(R.layout.activity_web);
    name = getIntent().getExtras().getString(Common.WEBVIEW_EXTRA_NAME);
    url = getIntent().getExtras().getString(Common.WEBVIEW_EXTRA_URL);
    color = getIntent().getExtras().getInt(Common.WEBVIEW_EXTRA_COLOR);
    needsLogin = getIntent().getExtras().getBoolean(Common.WEBVIEW_EXTRA_NLOGIN);
    //Action bar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    if (Build.VERSION.SDK_INT >= 21) {
        getWindow().setNavigationBarColor(color);
        getWindow().setStatusBarColor(color);
    }
    app = (App) getApplication();

    TextView title = (TextView) findViewById(R.id.toolbar_title);
    title.setText(name);

    progress = (ProgressBar) findViewById(R.id.web_progressBar);
    webView = (WebView) findViewById(R.id.webView);

    if (savedInstanceState != null) {
        progress.setVisibility(View.INVISIBLE);
        webView.setVisibility(View.VISIBLE);
        webView.restoreState(savedInstanceState);
    }
    else {
        progress.setVisibility(View.VISIBLE);
        webView.setWebViewClient(new WebViewClient());
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setUserAgentString("IEMobile");
        startControllers();
    }

}
 
开发者ID:Onelio,项目名称:ConnectU,代码行数:41,代码来源:WebActivity.java

示例6: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    setContentView(R.layout.activity_web);
    name = getIntent().getExtras().getString(Common.WEBVIEW_EXTRA_NAME);
    url = getIntent().getExtras().getString(Common.WEBVIEW_EXTRA_URL);
    color = getIntent().getExtras().getInt(Common.WEBVIEW_EXTRA_COLOR);
    needsLogin = getIntent().getExtras().getBoolean(Common.WEBVIEW_EXTRA_NLOGIN);
    //Action bar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    if (Build.VERSION.SDK_INT >= 21) {
        getWindow().setNavigationBarColor(color);
        getWindow().setStatusBarColor(color);
    }
    app = (App) getApplication();
    if (app.account == null && !app.loadUser()) //If account is null and cannot create user
        super.onDestroy();

    TextView title = (TextView) findViewById(R.id.toolbar_title);
    title.setText(name);

    progress = (ProgressBar) findViewById(R.id.web_progressBar);
    webView = (WebView) findViewById(R.id.webView);

    if (savedInstanceState != null) {
        progress.setVisibility(View.INVISIBLE);
        webView.setVisibility(View.VISIBLE);
        webView.restoreState(savedInstanceState);
    }
    else {
        progress.setVisibility(View.VISIBLE);
        webView.setWebViewClient(new WebViewClient());
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setUserAgentString("IEMobile");
        startControllers();
    }
}
 
开发者ID:Onelio,项目名称:ConnectU,代码行数:42,代码来源:WebmailActivity.java


注:本文中的android.webkit.WebView.restoreState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。