私はここで見つけるチュートリアルを仕事にしようとしています:https://developer.android.com/training/basics/firstapp/building-ui.htmlAndroidのチュートリアル「のシンボルを解決できません 『のsetText』」
アプリを構築しようとしたとき、私は上記のエラーを取得しています。私は答えを見つけようとしているのを見て回り、自分のコードをチェックしても無駄にしてみました。以下は
は私のコードです:
package com.example.chris.helloworld;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class DisplayMessageActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
}
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
TextView textView = findViewById(R.id.textView);
textView.setText(message);
}
とXML
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.chris.helloworld.DisplayMessageActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
任意の助けをいただければ幸いです。
貧しい人々の質問に対する謝罪、私は今明らかな誤りを認識しています。 – Doragan