EditText editText =(EditText)findViewById(R。 id.editText ); in “((R id.editText ))”Error cannot resolve symbol ‘EditText’
Today, there was an error when learning from the Android Studio development document. When starting another activity and building an intent, https://developer.android.google.cn/training/basics/firstapp/starting-activity#java
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
Solution, view activity_ main.xml , text edit box section
<EditText
android:id="@+id/editTextTextPersonName3"
Change the EditText in the SendMessage method to the corresponding, I’m here edittexttextpersonname3, as shown in the figure
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editTextTextPersonName3);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
Read More:
- Android monitor EditText text input EditText monitor events and input events
- Android solves the gliding problem of EditText
- Android learning notes 03: some problems and solutions in the learning process
- Android EditText cursor control, color modification, show and hide
- Solution to the error cannot resolve symbol reported by build.sbt
- Android project error: could not resolve com.android.support .c onstraint:constraint-layout :2.0.2.
- Android Studio sync build.gradle appears: Failed to resolve: com.android.support:appcompat problem
- Problems in the second day of Android learning
- About Android studio error: (26,13) failed to resolve: com.android.support : appcompat-v7:27. + error
- Failed to resolve: com.android.support:appcompat-v7:27.
- Android Studio could not resolve resource
- Error LNK2019: unresolved external symbol_ Main the symbol is in the function___ Tmaincrtstartup
- Solutions to the problem of “symbol lookup error xxxxx, undefined symbol”
- dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
- Failed to resolve: com.android.support:appcompat-v7:25.3.0
- OpenGL learning notes and other learning thinking
- Vs error unresolved external symbol_ Main, the symbol in the function “int”__ cdecl invoke_ main
- Android studio failed to resolve: com.github.CymChad :BaseRecyclerViewAdap terHelper:2.9.46
- [error log] 27.1.0 series of errors Error:Failed to resolve: com.android.support :support-an notations:27.1.0
- Android studio failed to resolve: junit:junit : 4.12 solutions