Message via intent error
<p>I'm learning how to use the intent to open a new activity and also pass a message, but when the new activity start, it needs to close down! What have I done wrong? Help is preciated! Thanks!</p>

<pre><code>package test.intent;

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

public class MainActivity extends Activity {

Button btn1;
String message;
public final static String EXTRA_MESSAGE = "test.intent.MESSAGE";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    btn1 = (Button) findViewById(R.id.btn1);

    btn1.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub

            message = "Message via an intent";      

            Intent intent = new Intent(MainActivity.this, Activity1.class);
            intent.putExtra(EXTRA_MESSAGE, message);
            startActivity(intent);
        }
    });
}

}
</code></pre>

<p>The activity that recieve the message:</p>

<pre><code>package test.intent;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class Activity1 extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    TextView display = (TextView) findViewById(R.id.txtv1);

     setContentView(R.layout.activity1);

     Intent intent = getIntent();
     String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    display.setText(message);
}
}
</code></pre>
