Switching activities/passing data between activities
<p>So using suggestions from the last question I asked, I figured out how to call BarCodeScanner, and return the value to a field. so now, I have a toast that says "successful scan" and then I want to pass the result to a new activity. when I comment out my intent, everything works (minus the passing of data/switching of screen, obviously) but when I run my project as is, it FC's... no errors reported by eclipse in code or XML. Any insights?</p>

<pre><code>package com.mhe.test.scan;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class main extends Activity {
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
   Button myScanButton = (Button) findViewById(R.id.myScanButton); 
   totalbox = (EditText) findViewById(R.id.tBox);        

     myScanButton.setOnClickListener(new Button.OnClickListener() {
       public void onClick(View v) {
         Intent intent = new Intent("com.google.zxing.client.android.SCAN");
         intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
         startActivityForResult(intent, 0);
      }
   });
  }
  private EditText totalbox;
  public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
      if (resultCode == RESULT_OK) {
      final String contents = intent.getStringExtra("SCAN_RESULT");

        if ( totalbox != null )
         totalbox.setText(contents);


        Context context = getApplicationContext();
        CharSequence text = "Successful Scan";
        int duration = Toast.LENGTH_SHORT;
        Toast toast = Toast.makeText(context, text, duration);
        toast.show();


    Intent i = new Intent(main.this, Result.class);
        i.putExtra("SNARP", "SCAN_RESULT");
        startActivityForResult(i, 0);

      } else if (resultCode == RESULT_CANCELED) {

        if ( totalbox != null )
          totalbox.setText("bummer");
      }
    }      
  }

}
</code></pre>

<p>And then to handle the data being passed, in the new activity:</p>

<pre><code>package com.mhe.test.scan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class Result extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.result);

    Intent i = getIntent();
    Bundle b = i.getExtras();
    String foosh = b.getString("SNARP");

    EditText box1 = (EditText) findViewById(R.id.tBox1);     
       box1.setText(foosh); 
</code></pre>
