Note that there are some explanatory texts on larger screens.

plurals
  1. POChanged value of a resource
    primarykey
    data
    text
    <p>I'm new to Android. A part of my Activity contains</p> <pre><code>TextView message = (TextView) findViewById(R.id.show_message); Intent intent = getIntent(); String name = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); message.setText(name); </code></pre> <p><code>MainActivity</code> was the previous activity from which the current one was called. Also, the layout file for the above activity is </p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/show_message" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content"&gt; &lt;/TextView&gt; &lt;Button android:id="@+id/button_back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/show_message" android:layout_centerHorizontal="true" android:layout_marginTop="17dp" android:onClick="goBack" android:text="Go Back to Activity Lifecycle" /&gt; </code></pre> <p></p> <p>I know that <code>message.setText(name)</code> sets the <code>String</code> value of <code>name</code> to <code>message</code> but how come it also changes <code>show_message</code>? When the <code>Activity</code> starts in the app, it shows the <code>String</code> value of <code>name</code> where it is supposed to display <code>show_message</code>. </p> <p>Actually, I want the code to perform in the way it is doing right now but I can't understand why.</p> <p>Thanks in advance!</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. 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