title: multiple webviews in Android
body: <p>I am developing an application in which I would like to create different webViews in some conditions. Despite having more than one webView, the idea is to show only one of them. </p>
  
  <p>I have seen that the best way is create a new class which extends Activity. </p>
  
  <p>This is the main class</p>
  
  <pre><code> public void onCreate(Bundle savedInstanceState)
      {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      Intent intent = new Intent(this, WebScreen.class);
      startActivity(intent);
      }
  </code></pre>
  
  <p>This is the second class I have done to create new Webviews</p>
  
  <pre><code>  public class WebScreen extends Activity { 
          private WebView myWebView; 
  
  
    @Override 
     public void onCreate(Bundle savedInstanceState) { 
         super.onCreate(savedInstanceState); 
         this.requestWindowFeature(Window.FEATURE_PROGRESS); 
  
      } 
  
      public void onClick(View arg0) { 
        return; 
       } 
  
       @Override 
       protected void onPause() { 
         myWebView = null; 
        super.onPause(); 
        } 
  
        @Override 
        protected void onStart(){  
         }
  
        @Override 
         protected void onResume() { 
            super.onResume(); 
            myWebView = new WebView(this); 
            myWebView.getSettings().setJavaScriptEnabled(true); 
            myWebView.loadUrl("myURL"); 
            setContentView(myWebView); 
         }   
  
          @Override 
          public void onBackPressed() { 
            super.onBackPressed();
            myWebView = null; 
           } 
  </code></pre>