Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to Override <code>onCreate</code> in your secondActivity and have <code>setContentView(R.layout.mylayout)</code>. Then you can initialize your textview.</p> <p>Also you need to start an Activity using intent</p> <pre><code> Intent intent = new Intent(MainActivtiy.this,SecondActivity.class); startActivity(intent); </code></pre> <p>Remember to make an entry for the activity (SecondActivtiy) in manifest file</p> <p>If you need to pass the string to second activity use intent.putExtra</p> <pre><code> Intent intent = new Intent(MainActivtiy.this,SecondActivity.class); intent.putExtra("key",mystring); startActivity(intent); </code></pre> <p>Then in secondActivity</p> <pre><code> TextView tv ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mysecondlayout); tv = (TextView) findViewByid(R.id.textView1); Bundle extras = getIntent().getExtras(); if (extras != null) { String value = extras.getString("key"); tv.setText(value); //get the value based on the key } </code></pre> <p><a href="http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String" rel="nofollow">http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String</a>, android.os.Bundle)</p> <p>You can <code>findViewById</code> of the current view herarchy set to the activity. </p> <p>Also you need to startActivity using intent rather doing this <code>econdClass x = new secondClass()</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload