How to pass a string between two activities
<p>I am just starting with Android development and I have a problem. I am trying to the next thing:</p>

<p>I have an Activity1 that has a button, "0". Also I have Activity2 that has a TextView and an OK button.</p>

<p>When I press on "0", I want to pass some string to Activity2.</p>

<p>When I press on 0, Activity2 has to open, and in it TextView have to show the string that I passed. After pressing on OK (in Activity2), I want to come back to the Activity1.</p>

<p>I tried to do this in this way:</p>

<p><strong>Activity1</strong></p>

<pre><code>case R.id.b0:
    errorString = "Error: a number can't start with 0";
    Bundle basket = new Bundle();
    basket.putString("error", errorString);
    Intent person = new Intent("my.firsttraining.app.vitali.ERRORPAGE");
    person.putExtras(basket);
    startActivity(person);
</code></pre>

<p><strong>Activity2</strong></p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    bOK= (Button)findViewById(R.id.bOKonError);
    errorDisplay = (TextView)findViewById(R.id.tvError);

    bOK.setOnClickListener(this);
    setContentView(R.layout.errorpage);

    Bundle gotBasket = getIntent().getExtras();
    String error = gotBasket.getString("error");
    errorDisplay.setText(error); ``
</code></pre>

<p>I also tried to do something like this:</p>

<p><strong>Activity1</strong></p>

<pre><code>case R.id.b0:
    errorString = "Error: a number can't start with 0";
    basket = new Bundle();
    basket.putString("error", errorString);
    person = new Intent("my.firsttraining.app.vitali.ERRORPAGE");
    person.putExtras(basket);
    setResult(RESULT_OK, person);
    finish();
</code></pre>

<p><strong>Activity2</strong></p>

<pre><code>    bOK.setOnClickListener(this);
    setContentView(R.layout.errorpage);
}

public void onClick(View v)
{
    Intent in = new Intent("my.firsttraining.app.vitali.MENU");
    startActivity(in);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK)
    {
        Bundle gotBasket= data.getExtras();
        String err = gotBasket.getString("error");
        errorDisplay.setText(err);
    }
}
</code></pre>

<p>After all this, I have an error. After clicking on Button 0, my application crashes. I get the following error.</p>

<blockquote>
  <p>The application has stopped unexpectedly. Please try again</p>
</blockquote>

<p>and the button with text "Force Close".</p>

<p>I have to say that I do not really understand the second option. I just saw it in some tutorial.</p>
