Get the time stamp from the device to display in a textview?
<p>I am trying to get a time stamp into a textview or any view for the matter in an activity that will give the time when the activity is opened from a button plus display the input from two edit text's into text view's that are in seperate activities.  For example:</p>

<p>Activity <code>Main</code>:</p>

<pre><code>import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

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

        Button b = (Button) findViewById(R.id.button1);
        b.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

            }
        });
    }
}
</code></pre>

<p>Which includes this xml layout and views:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" &gt;

    &lt;TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" /&gt;

    &lt;EditText
        android:id="@+id/editText1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" &gt;

        &lt;requestFocus /&gt;
    &lt;/EditText&gt;

    &lt;EditText
        android:id="@+id/editText2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" /&gt;

    &lt;Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Now I want to get the user input from these two edit text's while opening this next activity with the onClick from the button plus display the time stamp from the time the button was clicked:</p>

<pre><code>import android.app.Activity;
import android.os.Bundle;

public class Main2 extends Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
    }


}
</code></pre>

<p>Which inflates this xml layout:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" &gt;

    &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="TextView" android:textSize="20dp"/&gt;

    &lt;TextView
        android:id="@+id/textView2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="TextView" android:textSize="20dp"/&gt;

    &lt;TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>So I want to accomplish the following:</p>

<pre><code>         editText1        -----------&gt;          textView1
         editText2        -----------&gt;          textView2
                       Phone's time stamp       textview3
</code></pre>

<p>and open Main2 activity with the click of the button. So editText1 is an EditText that will take user input and return that value into textView1, the same for editText2 and textView2, but on top of that I want to get the time the button is clicked and the time returned into textView3.  </p>

<p>Now I know how to return the value of one edittext to a textview in another activity but not two and get a time stamp.   </p>

<p><strong>LAS_VEGAS</strong>
OK I got the two identifiers to work but getting an error on the time stamp here is what I have as far as code :</p>

<p>This is what I have in the first Activities onClick method:</p>

<pre><code>EditText edit = (EditText) findViewById(R.id.etTitle);
            EditText editP = (EditText) findViewById(R.id.etPrice);
            long currentTime = System.currentTimeMillis();

            Intent intent = new Intent(Post.this, PostSet.class);
            intent.putExtra("com.main.espress.POSTSET",                         `edit.getText().toString());`
            intent.putExtra("com.main.espress.NEW",      editP.getText().toString());
            intent.putExtra("currentTime", currentTime);
            startActivity(intent);
</code></pre>

<p>This is what my second Activity has:</p>

<pre><code>TextView tv1 = (TextView) findViewById (R.id.tvTitleText);
        TextView tv2 = (TextView) findViewById (R.id.tvPrice);
        TextView tv3 = (TextView) findViewById (R.id.tvTimeStamp);

        Intent intent = getIntent();
        String edit = intent.getStringExtra("com.main.express.POSTSET");
        String editP = intent.getStringExtra("com.main.espress.NEW");
        long currentTime = extras.getLong("currentTime");

        tv1.setText(edit);
        tv2.setText(editP);
        tv3.setText(currentTime);
</code></pre>
