Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Adding text to a textview in different xml layout by clicking button
    primarykey
    data
    text
    <p>I just need a little help with the android program that I am making. Basically, I have a button in one of my XML layouts, and when that button is pressed, it should add the name of that activity into a TextView which is located in another XML layout. </p> <p>So this is the button that needs pressing. </p> <pre><code> &lt;Button android:id="@+id/add_to_schedule" android:layout_width="150dp" android:layout_height="30dp" android:layout_below="@+id/widget44" android:layout_centerHorizontal="true" android:text="@string/add_to_schedule" android:textColor="#ffffffff" android:textSize="12sp" android:typeface="serif" /&gt; </code></pre> <p>And this is the TextView which is in a different XML Layout that I want it to display the information to.</p> <pre><code>&lt;TextView android:id="@+id/txtview" android:layout_width="300dp" android:layout_height="200dp" android:layout_alignLeft="@+id/textview" android:layout_alignParentBottom="true" android:layout_marginBottom="76dp" android:text="@string/textview" /&gt; </code></pre> <p>This is the class where the Button will be pressed from.</p> <pre><code>public class Aerobic_Steps extends Activity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.aerobic_steps); } } </code></pre> <p>And this is the Class which the TextView will belong to. </p> <pre><code>public class Training_Schedule extends Activity{ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.training_schedule); } } </code></pre>
    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.
 

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