Dear,
I'm new to Android/Java, trying to replicate the exercise from https://developer.android.com/training/basics/firstapp/index.html in Android Studio 2.3
After the last step "Start Another Activity" I get the error message "Cannot resolve symbol setText" in statement textView.setText(message);
Why?
Sorry for stupid question
Code as follows:
I'm new to Android/Java, trying to replicate the exercise from https://developer.android.com/training/basics/firstapp/index.html in Android Studio 2.3
After the last step "Start Another Activity" I get the error message "Cannot resolve symbol setText" in statement textView.setText(message);
Why?
Sorry for stupid question
Code as follows:
Code:
package acme.hello_world;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class DisplayMessageActivity extends AppCompatActivity {
[USER=1021285]@override[/USER]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
}
// Get the Intent that started this activity and extract the string
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
// Capture the layout's TextView and set the string as its text
TextView textView = (TextView)findViewById(R.id.textView);
textView.setText(message);
}
Last edited by a moderator: