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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:39:21+00:00 2026-05-26T05:39:21+00:00

Simple code: public class ZSEEActivity extends TabActivity { private WebView webview ; private WebView

  • 0

Simple code:

public class ZSEEActivity extends TabActivity {
private WebView webview ; 
private WebView webviewtwo;
private TabHost mTabHost;
private int a;


protected void onStart() {
    super.onStart();
    // The activity is about to become visible.
}
protected void onStop() {
    super.onStop();
    // The activity is about to become visible.
}
protected void onRestart() {
    super.onRestart();
}
protected void onDestroy(){
    super.onDestroy();
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final Activity activity = this;


    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));



    webview = (WebView) findViewById(R.id.webView1);
    webviewtwo = (WebView) findViewById(R.id.webView2);
    final WebSettings webviewtwoSettings = webviewtwo.getSettings();
        if (savedInstanceState != null){
            webview.restoreState(savedInstanceState.getBundle("stateone"));
            webviewtwo.restoreState(savedInstanceState.getBundle("statetwo"));
            webviewtwoSettings.setTextSize(TextSize.LARGER);
            mTabHost.setCurrentTab(savedInstanceState.getInt("CURRENT_TAB"));

        }
        else{
            webview.loadUrl("http://zsee.bytom.pl/ogloszenia.php");
            webviewtwo.loadUrl("http://zsee.bytom.pl/plannew/index.html");
            webviewtwoSettings.setTextSize(TextSize.LARGER);
            mTabHost.setCurrentTab(0);
        }


    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");
           webviewtwoSettings.setTextSize(TextSize.NORMAL);
         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 outStateone = new Bundle();
    Bundle outStatetwo = new Bundle();
    webview.saveState(outStateone);
    webviewtwo.saveState(outStatetwo);


    outState.putBundle("stateone", outStateone);
    outState.putBundle("statetwo", outStatetwo);
    outState.putInt("CURRENT_TAB", mTabHost.getCurrentTab());
}



public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
    case R.id.item1:
        final AlertDialog alertdialog= new AlertDialog.Builder(this).create();
        alertdialog.setTitle("O Programie");
        alertdialog.setMessage("Zmiany w 1.0.1: \n-Obsługa planu z dnia 17.10.2011\n-Drobne Poprawki");
        alertdialog.setButton("Fajno", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                alertdialog.cancel();
           }
       });
        alertdialog.show();
        return true;
    case R.id.item2:
        finish();
    case R.id.item3:
        if(mTabHost.getCurrentTab() == 0){
        webview.loadUrl("http://zsee.bytom.pl/ogloszenia.php");
        }
        else if(mTabHost.getCurrentTab() == 1)
        {
        webviewtwo.loadUrl("http://zsee.bytom.pl/plannew/index.html");
        }
    default:
        return super.onOptionsItemSelected(item);
    }
}
}

Now My problem. After i press back button onStop() code is executed and onDestroy. How i can don’t kill app ? I wanna this app in background. Now when i press back button and open app, all data is again downloaded and loaded to webview. Soo how make this process work in background ?

Sorry for my haotic english 🙂

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-26T05:39:22+00:00Added an answer on May 26, 2026 at 5:39 am

    Use Android service for doing something in Background rather then Activity.

    And use Broadcast receiver to invoke your Activity from service. When something your background work finished.

    Android – Service

    And if you want to do some little then just override onKeyDown()

    @Override     
     public boolean onKeyDown(int keyCode, KeyEvent event) 
      {         
        if (keyCode == KeyEvent.KEYCODE_BACK) 
           {            
         // put your stuff here or just block the back button for perticular activity             
               return true;        
           }         
         return super.onKeyDown(keyCode, event); 
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Check out the simple code below : Public Class Form1 Private _items As List(Of
Is it worth to write unit-tests for such the simple code: public class TableController
Please look at simple code below public class A{} public class B: A{} public
Given this code: public class Car { public virtual int CarId { get; set;
I have a simple piece of code: public string GenerateRandomString() { string randomString =
So here is the simple code: [System.ComponentModel.DefaultValue(true)] public bool AnyValue { get; set; }
This very simple code gives me tons of errors: #include <iostream> #include <string> int
I've got such a simple code: <div class=div1> <div class=div2>Foo</div> <div class=div3> <div class=div4>
Suppose you are given a Class.dll assembly compiled from the following simple code: namespace
Simple code: >>> set([2,2,1,2,2,2,3,3,5,1]) set([1, 2, 3, 5]) Ok, in the resulting sets there

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.