title: How to open url in webview activity
body: <p>How to open Url in Webview activity</p>
  
  <p>Hi,</p>
  
  <p>i want to open link in WebView activity right now my code is scan barcode &amp; open link directly to browser but
  i want to change it and open in Webview 
  how can i do this please help me to fix this issue </p>
  
  <p>thanks</p>
  
  <p>here is code of BarcodeScannerActivity</p>
  
  <pre><code>   public class BarcodeScannerActivity extends AppCompatActivity {
  
      String scanContent;
      String scanFormat;
      TextView textView;
      Button button;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_barcode_scanner);
          textView = (TextView) findViewById(R.id.textView);
          button = (Button) findViewById(R.id.button);
  
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  IntentIntegrator scanIntegrator = new IntentIntegrator(BarcodeScannerActivity.this);
                  scanIntegrator.setPrompt("Scan");
                  scanIntegrator.setBeepEnabled(true);
  
                  //enable the following line if you want QR code
                  //scanIntegrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
  
                  scanIntegrator.setCaptureActivity(CaptureActivityAnyOrientation.class);
                  scanIntegrator.setOrientationLocked(true);
                  scanIntegrator.setBarcodeImageEnabled(true);
                  scanIntegrator.initiateScan();
              }
          });
  
  
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
          if (scanningResult != null) {
              if (scanningResult.getContents() != null) {
                  scanContent = scanningResult.getContents().toString();
                  scanFormat = scanningResult.getFormatName().toString();
              }
  
              Toast.makeText(this, scanContent + "   type:" + scanFormat, Toast.LENGTH_SHORT).show();
  
              textView.setText(scanContent + "    type:" + scanFormat);
  
  
  
              Intent browseintent=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com/index.php?iduser="+ scanContent));
              startActivity(browseintent);
  
          } else {
              Toast.makeText(this, "Nothing scanned", Toast.LENGTH_SHORT).show();
          }
      }
  }
  </code></pre>
  
  <p>Webview Activity Code</p>
  
  <pre><code>        public class SecondActivity extends AppCompatActivity {
              Button b1;
              EditText ed1;
  
              private WebView wv1;
              @Override
              protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_second);
  
                  b1=(Button)findViewById(R.id.button);
                  ed1=(EditText)findViewById(R.id.editText);
  
                  wv1=(WebView)findViewById(R.id.webView);
                  wv1.setWebViewClient(new MyBrowser());
  
                  b1.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          String url = ed1.getText().toString();
  
                          wv1.getSettings().setLoadsImagesAutomatically(true);
                          wv1.getSettings().setJavaScriptEnabled(true);
                          wv1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
                          wv1.loadUrl(url);
                      }
                  });
              }
  
              private class MyBrowser extends WebViewClient {
                  @Override
                  public boolean shouldOverrideUrlLoading(WebView view, String url) {
                      view.loadUrl(url);
                      return true;
                  }
              }
          }
  </code></pre>