WebView saveState - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for WebView saveState method.

This code example shows how to use the following methods:getUrl, saveState
    } 
  } 
 
  @Override 
  protected void onSaveInstanceState(Bundle state) {
    String url = webView.getUrl();
    if (url != null && url.length() > 0) {
      webView.saveState(state);
      state.putBoolean(WEBVIEW_STATE_PRESENT, true);
    } 
  } 
 
  @Override 
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
      if (webView.canGoBack()) {
        webView.goBack();
        return true; 
      } 
    } 
8
CodeRank
This code example shows how to use the following methods:getUrl, saveState
    doneButton.setOnClickListener(doneListener);
  } 
 
  @Override 
  protected void onSaveInstanceState(Bundle state) {
    String url = webView.getUrl();
    if (url != null && url.length() > 0) {
      webView.saveState(state);
      state.putBoolean(WEBVIEW_STATE_PRESENT, true);
    } 
  } 
 
  @Override 
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
      if (webView.canGoBack()) {
        webView.goBack();
        return true; 
      } 
    } 
7
CodeRank
This code example shows how to use the following methods:saveState
    super.onSaveInstanceState(state);
     
    WebView browser=getBrowser();
     
    if (browser!=null) {
      browser.saveState(state);
    } 
  } 
   
  public void loadUrl(String url) {
    getBrowser().loadUrl(url);
  } 
   
  private WebView getBrowser() {
    return((WebView)(getView().findViewById(R.id.browser)));
  } 
 
  private class RedirectFixer extends WebViewClient {
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
      view.loadUrl(url);
7
CodeRank
This code example shows how to use the following methods:saveState
        outState.putString(ARG_INITIAL_URL, mInitialUrl);
        outState.putString(ARG_TARGET_URL, mTargetUrl);
         
        // Save the state of the WebView 
        Bundle webviewState = new Bundle();
        mSsoWebView.saveState(webviewState);
        outState.putBundle(KEY_WEBVIEW_STATE, webviewState);
    } 
 
    @Override 
    public void onDestroyView() { 
        Log_OC.d(TAG, "onDestroyView");
         
        mSsoWebView.setWebViewClient(null);
         
        // Work around bug: http://code.google.com/p/android/issues/detail?id=17423 
        Dialog dialog = getDialog();
        if ((dialog != null)) {
            dialog.setOnDismissListener(null);
            //dialog.dismiss(); 
6
CodeRank
This code example shows how to use the following methods:saveState
 
   @Override 
   public void onSaveInstanceState(Bundle outState) {
      super.onSaveInstanceState(outState);
      if (mWebView != null) {
         mWebView.saveState(outState);
      } 
   } 
 
   @Override 
   protected void onDestroy() { 
      super.onDestroy(); 
      final WebView webview = (WebView) findViewById(R.id.full_screen_web_view);
      webview.loadData("", "text/html", "utf-8");
   } 
 
} 
5
CodeRank
This code example shows how to use the following methods:getUrl, saveState
    } 
  } 
 
  @Override 
  protected void onSaveInstanceState(Bundle state) {
    String url = webView.getUrl();
    if (url != null && url.length() > 0) {
      webView.saveState(state);
      state.putBoolean(WEBVIEW_STATE_PRESENT, true);
    } 
  } 
 
  @Override 
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
      if (webView.canGoBack()) {
        webView.goBack();
        return true; 
      } 
    } 
5
CodeRank
This code example shows how to use the following methods:saveState
		doneButton.setOnClickListener(doneListener);
	} 
 
	@Override 
	protected void onSaveInstanceState(Bundle state) {
		webView.saveState(state);
	} 
 
	@Override 
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			if (webView.canGoBack()) {
				webView.goBack();
				return true; 
			} 
		} 
		return super.onKeyDown(keyCode, event);
	} 
 
	private final class HelpClient extends WebViewClient {
5
CodeRank
This code example shows how to use the following methods:saveState
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        if (web != null)
            web.saveState(outState);
    } 
 
    public class MyWebViewClient extends WebViewClient {
        @Override 
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false; 
        } 
 
        @Override 
        public void onReceivedError(WebView view, int errorCode, String description,
                String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);
            Toast.makeText(getActivity(), description, Toast.LENGTH_LONG);
        } 
5
CodeRank
This code example shows how to use the following methods:saveState
        return MusicServiceFactory.getMusicService(this).getVideoUrl(this, id);
    } 
 
    @Override 
    protected void onSaveInstanceState(Bundle state) {
        webView.saveState(state);
    } 
 
    private void callHiddenWebViewMethod(String name){
        if( webView != null ){
            try { 
                Method method = WebView.class.getMethod(name);
                method.invoke(webView);
            } catch (Throwable x) {
                Log.e(TAG, "Failed to invoke " + name, x);
            } 
        } 
    } 
 
    private boolean isFlashPluginInstalled() { 
5
CodeRank
This code example shows how to use the following methods:saveState
        return MusicServiceFactory.getMusicService(this).getVideoUrl(this, id);
    } 
 
    @Override 
    protected void onSaveInstanceState(Bundle state) {
        webView.saveState(state);
    } 
 
    private void callHiddenWebViewMethod(String name){
        if( webView != null ){
            try { 
                Method method = WebView.class.getMethod(name);
                method.invoke(webView);
            } catch (Throwable x) {
                Log.e(TAG, "Failed to invoke " + name, x);
            } 
        } 
    } 
 
    private boolean isFlashPluginInstalled() { 
4
CodeRank

Related WebView saveState Questions & Answers:

saveState Method Overview
Saves the state of this WebView used in onSaveInstanceState(Bundle).
See Code Examples for other Android WebView Methods: