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 6676919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:03:09+00:00 2026-05-26T04:03:09+00:00

First i will paste my code. public class ZSEEActivity extends TabActivity { private WebView

  • 0

First i will paste my code.

public class ZSEEActivity extends TabActivity {
private WebView webview ; 
private WebView webviewtwo;




/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final Activity activity = this;


    TabHost mTabHost = getTabHost();

    mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("Zastępstwa").setContent(R.id.tab1));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("Plan Lekcji").setContent(R.id.tab2));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("O programie").setContent(R.id.tab3));

    mTabHost.setCurrentTab(0);


    webview = (WebView) findViewById(R.id.webView1);
    webviewtwo = (WebView) findViewById(R.id.webView2);
    WebSettings webviewtwoSettings = webviewtwo.getSettings();
        if (savedInstanceState != null){
          webview.restoreState(savedInstanceState);
          webviewtwo.restoreState(savedInstanceState);
        }
        else{
            webview.loadUrl("http://zsee.bytom.pl/ogloszenia.php");
            webviewtwoSettings.setDefaultFontSize(30);
            webviewtwo.loadUrl("http://zsee.bytom.pl/plany/index.html");
        }


    webview.setWebViewClient(new WebViewClient() {
           public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
               String summary = "<html><body><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" ><center>Coś się zepsuło :(</center></body></html>";
               webview.loadData(summary, "text/html","utf-8");
             Toast.makeText(activity, "O nie! " + description, Toast.LENGTH_SHORT).show();
           }
         });

    webviewtwo.setWebViewClient(new WebViewClient() {
       public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
           String summary = "<html><body><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" ><center>Coś się zepsuło :(</center></body></html>";
           webviewtwo.loadData(summary, "text/html","utf-8");
         Toast.makeText(activity, "O nie! " + description, Toast.LENGTH_SHORT).show();
       }
     });

    }
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);
    return true;
}

protected void onSaveInstanceState(Bundle outState, Bundle Test) {
    webview.saveState(outState);
    webviewtwo.saveState(Test);
}



public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.item1:
        AlertDialog alertdialog= new AlertDialog.Builder(this).create();
        alertdialog.setTitle("Pomoc");
        alertdialog.setMessage("Lepszy Planer od Sierran'a :>");
        alertdialog.show();
        return true;
    case R.id.item2:
        finish();
    case R.id.item3:
        webview.loadUrl("http://zsee.bytom.pl/ogloszenia.php");
        System.out.print("ss");
    default:
        return super.onOptionsItemSelected(item);
    }
}
}

Now is my question. I have two webview widget. One is called webview and another webviewtwo. I’m newbie in android programing so i have problem how save two widgets in onSaveInstanceState and how restore them. Now webviewtwo overwrite webview and in webview windows i have page from webviewtwo. How fix it and do it right ?

Sierran

  • 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-05-26T04:03:10+00:00Added an answer on May 26, 2026 at 4:03 am

    onSaveInstanceState takes only one Bundle.

    Save the webview states into separate Bundles, then put them into the saved one:

    Bundle state1=new Bundle();
    webview.saveState(state1);
    Bundle state2=new Bundle();
    webviewtwo.saveState(state2);
    outState.putBundle("state1",state1);
    outState.putBundle("state2",state2);
    super.onSaveInstanceState(outState);
    

    Restoring:

    webview.restoreState(savedInstanceState.getBundle("state1"));
    webviewtwo.restoreState(savedInstanceState.getBundle("state2"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, will the first piece of code perform a full search twice, or
Little to say ill just paste my code hoping that someone will see what
First I will try to explain what I want to do. The app loads
I have a CSV file. The first row will always contain column headers. Depending
I have two desktop applications. After closing the first application, the first application will
I want to display a UITableView with Multiple Columns. The first column will have
Which command will executed first,If a stored procedure have individual multiple select commands;
I am writing my first project that will use autoconf and teaching it to
I know one awkward solution for this taks will be : first use ct
With :limit in query, I will get first N records. What is the easiest

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.