I have an app that scans qr code. The app returns the url in a string named value. I want to open the url in a webview. How can I call the WebViewActivity in CameraTestActivity the the WebViewActivity uses the url from the CameraTestActvity for loading the website. There are comments in the code for the things I want to do but I do not know how. Can you please help me? I may be not able to graduate because of this problem? I've been doing this for days.
CameraTestActivity.java
import net.sourceforge.zbar.Config;
import net.sourceforge.zbar.Image;
import net.sourceforge.zbar.ImageScanner;
import net.sourceforge.zbar.Symbol;
import net.sourceforge.zbar.SymbolSet;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.hardware.Camera;
import android.hardware.Camera.AutoFocusCallback;
import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.Size;
import android.os.Bundle;
import android.os.Handler;
import android.text.method.LinkMovementMethod;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;
/* Import ZBar Class files */
@SuppressLint("SetJavaScriptEnabled")
public class CameraTestActivity extends Activity
{
    private Camera mCamera;
    private CameraPreview mPreview;
    private Handler autoFocusHandler;
    TextView scanText;
    Button scanButton;
    Button exitButton;
    WebView web;
    ImageScanner scanner;
    private boolean barcodeScanned = false;
    private boolean previewing = true;
    static {
        System.loadLibrary("iconv");
    } 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        autoFocusHandler = new Handler();
        mCamera = getCameraInstance();
        /* Instance barcode scanner */
        scanner = new ImageScanner();
        scanner.setConfig(0, Config.X_DENSITY, 3);
        scanner.setConfig(0, Config.Y_DENSITY, 3);
        mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);
        FrameLayout preview = (FrameLayout)findViewById(R.id.cameraPreview);
        preview.addView(mPreview);
        scanText = (TextView)findViewById(R.id.scanText);
        scanButton = (Button)findViewById(R.id.ScanButton);
        scanButton.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    if (barcodeScanned) {
                        barcodeScanned = false;
                        scanText.setText("Place code inside the square to scan");
                        mCamera.setPreviewCallback(previewCb);                       
                        mCamera.startPreview();
                        previewing = true;
                        mCamera.autoFocus(autoFocusCB);
                    }
                }
            });
        exitButton = (Button)findViewById(R.id.ExitButton);
        exitButton.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
            System.exit(0);
        }
    });
    }
    public void onPause() {
            super.onPause();
            if (mCamera != null) {
                mCamera.setPreviewCallback(null);
                mPreview.getHolder().removeCallback(mPreview);   // you need this line
                releaseCamera();
        }
    }
    @Override
    public void onResume() {
        super.onResume();  
        // Get the Camera instance as the activity achieves full user focus
        try {       
            mCamera = Camera.open();          
            mCamera.setPreviewCallback(null);      
            mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);
            FrameLayout preview = (FrameLayout)findViewById(R.id.cameraPreview);
            preview.addView(mPreview); 
            mCamera.startPreview();              
        } catch (Exception e) {      
        }      
}
    /** A safe way to get an instance of the Camera object. */
    public static Camera getCameraInstance(){
        Camera c = null;
        try {
            c = Camera.open();
        } catch (Exception e){
        }
        return c;
    }
    private Runnable doAutoFocus = new Runnable() {
            public void run() {
                if (previewing)
                    mCamera.autoFocus(autoFocusCB);
            }
        };
    PreviewCallback previewCb = new PreviewCallback() {
            public void onPreviewFrame(byte[] data, Camera camera) {
                Camera.Parameters parameters = camera.getParameters();
                Size size = parameters.getPreviewSize();
                Image barcode = new Image(size.width, size.height, "Y800");
                barcode.setData(data);
                int result = scanner.scanImage(barcode);
                if (result != 0) {
                    previewing = false;
                    mCamera.setPreviewCallback(null);
                    mCamera.stopPreview();
                    SymbolSet syms = scanner.getResults();
                    for (Symbol sym : syms) {
                      String value = new String(sym.getData()); //url scanned from the qr code 
                      if(value.startsWith("http://192.168.1.6")){ //if the url starts with 
                      scanText.setText("QR Code result: " + value);
                        barcodeScanned = true;
                        //intent for WebViewActivty.java 
                        //The WebViewActivty.java should load the string value which contains the the url 
                      }
                      else{
                          scanText.setText("QR Code result 2: " + value);
                          barcodeScanned = true;
                          }
                       TextView tv = (TextView) findViewById(R.id.scanText);
                        tv.setMovementMethod(LinkMovementMethod.getInstance());
                    }
                }
            }
        };
    // Mimic continuous auto-focusing
    AutoFocusCallback autoFocusCB = new AutoFocusCallback() {
            public void onAutoFocus(boolean success, Camera camera) {
                autoFocusHandler.postDelayed(doAutoFocus, 1000);
            }
        };
        private void releaseCamera(){
            if (mCamera != null){
                mCamera.release();        // release the camera for other applications
                mCamera = null;
            }
        }
}
WebViewActivity.java
    package net.sourceforge.zbar.android.CameraTest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebViewActivity extends Activity {
    private WebView webView;
    @SuppressLint("SetJavaScriptEnabled")
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);
        webView = (WebView) findViewById(R.id.web_engine);
        webView.setWebViewClient(new MyWebClient()); 
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadUrl("http://192.168.1.6/sp/products.php");//the link should be from the CameraTestActivity
    }
}   
 class MyWebClient extends WebViewClient {
     @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            // TODO Auto-generated method stub
            super.onPageStarted(view, url, favicon);
        }
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // TODO Auto-generated method stub
            return false;
        }
 }
 
     
    