Android/Java passing value from one screen to another and displaying value

I am a beginner, and having trouble. I have two pages. On user enters name and clicks button. On second screen I need to have "Hello"+ the name they entered on the first page. So for the first page I have:

  public class LogonActivity extends Activity
private EditText enterName;

protected void onCreate(Bundle savedInstanceState) 
    //associate view with activity
    //set the button
    Button button=(Button)findViewById(;
    //access the field where the user entered the name
    final EditText editTextName= (EditText)findViewById(;

    //button listener
    button.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            //save the editTextName to a new variable -enterName
            String enterName=editTextName.getText().toString(); 

            //create explicit intent
    Intent nameResultsIntent = new 
            //pass that to next activity
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(, menu);
    return true;

On the second page is: public class ConfirmationActivity extends Activity {

EditText enterName;

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    //associate the layout with this activity using setContentView


    //get the name the user entered
    String enterName=getIntent().getStringExtra("PERSON_NAME");


    String confirmationText = enterName;




So... its the last lines on the ConfirmationPage.

The Text field on the 1st page is : android:id="@+id/enterName" The field on the 2nd page where I want the text to appear is :

Can someone help with the last line to show the text on the second page?


Try something like this

//get the name the user entered
String enterName=getIntent().getStringExtra("PERSON_NAME");

EditText confirmationText = (EditText)findViewById(;


Need Your Help

What should be done with parsed text before inserting it to DB by SQL?

sql ruby-on-rails

In reasons of speed increase I decide to use raw SQL. So, with ActiveRecord I had 17714 ms for fill DB, now I have 1730 ms. Good, isn't it? But here is one problem, texts are different from each ot...

Handling Reference Types

c# reference types

When reference variable can be passed by reference :