Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7919795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:58:56+00:00 2026-06-03T15:58:56+00:00

I have a webview which is loading a url. If I change the orientation

  • 0

I have a webview which is loading a url. If I change the orientation of my tablet the webview load’s the URL again. How can I retain the state of webview on orientation change so that it does not restart loading the url. So far I’ve tried this :-

    @Override
   public void onSaveInstanceState(Bundle savedInstanceState) {
        //Save the state of Webview
        wv.saveState(savedInstanceState);
        super.onSaveInstanceState(savedInstanceState);
    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        // Restore the state of webview
       wv.restoreState(savedInstanceState);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    WindowManager.LayoutParams.FLAG_FULLSCREEN );
    setContentView(R.layout.html);

    if(savedInstanceState!=null){
        // Restore webview state 
        wv.restoreState(savedInstanceState);
     }

    WebView wv = (WebView) findViewById(R.id.webView1);

    wv.getSettings().setJavaScriptEnabled(true);
        wv.getSettings().setBuiltInZoomControls(true);
        wv.setPadding(0, 0, 0, 0);
        wv.setInitialScale(50);
        wv.getSettings().setLoadWithOverviewMode(true);
        wv.getSettings().setUseWideViewPort(true);

        _dialog = ProgressDialog.show(HtmlActivity.this, "", "Loading...", true, true);
        _dialog.setCancelable(true);
        _dialog.show();

        wv.loadUrl("http://www.samsung.com");

        wv.setWebViewClient(new WebViewClient()
        {

                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {

                    return super.shouldOverrideUrlLoading(wv, url);
                }

                @Override
                public void onPageStarted(WebView view, String url, Bitmap favicon) {
                    //_dialog =ProgressDialog.show(HtmlActivity.this, "", "Please wait..."); 
                        super.onPageStarted(wv, url, favicon);
                }

                @Override
                public void onPageFinished(WebView view, String url) {
                    try{
                         _dialog.dismiss();
                        }catch (Exception e) {
                            // TODO: handle exception
                        }
                      //  super.onPageFinished(wv, url);
                }
        });
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:58:57+00:00Added an answer on June 3, 2026 at 3:58 pm

    In your Manifest file, for the web-view’s activity write:

     android:configChanges="orientation|screenSize" 
    

    for newer API’s add the screenSizeproperty too…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Universal app with a webView which resize when an orientation change
I have a webview that I'm creating in an Activity which is a child
I have an embedded WebView in my Cocoa application in which I load an
I have a webview and an string that holds over 500kb which displays the
I have a WebView into which I'm loading the facebook sharer php page. This
Cocoa app, SnowLeopard I have a WebView in to which I'm loading HTML (essentially
I have an webView in a Cocoa application which I edit the contents programatically.
I have a webview, which shows the pages of a ebook. I want to
I have the following code which loads and html file into a webview -
I have a root UIViewController which has a property called webView. WebView is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.