Android가 처음입니다. 내 활동의 일부 변경된 리소스 값
TextView message = (TextView) findViewById(R.id.show_message);
Intent intent = getIntent();
String name = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
message.setText(name);
MainActivity
<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" >
<TextView
android:id="@+id/show_message"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content">
</TextView>
<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" />
나는 message.setText(name)
이 message
에 name
의 String
값을 설정하는 것을 알고 있지만 방법은 또한 show_message
을 변경 와서입니까? 앱에서 Activity
이 시작되면 이라고 표시되는 name
의 값인 String
이 표시됩니다.
실제로 코드가 현재 수행중인 방식으로 수행되기를 원하지만 이유를 이해할 수 없습니다.
미리 감사드립니다.
키 값을 MainActivity.EXTRA_MESSAGE – Aerrow
으로 지정했는데 무엇이 문제입니까? 당신은 여분의 가치에 show_message TV의 텍스트를 할당하고 있습니다. – njzk2
나는 프로그램이 무엇을하고 있는지 알았지 만 어떻게 그렇게되었는지 몰랐다. 하지만 지금은 Paul에게 감사 드린다. – Ankush