Yes, I’m totally new to this platform, but getText() IS a method of EditText, is it not?
I just copied and pasted the exact error from my simple app, which I copied word-for-word from a web tutorial. I believe it’s self-explanatory. It’s an error that might only come up if there was a misspelling. Below is the context. Error is on the 3rd line down.
public void sendMessage (View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
Would there be ANY circumstance where getText() would NOT be considered a method of EditText?
No,
getText()is a method in every version ofandroid.widget.EditText. Unless you have created another class with the nameEditText, this error is probably Eclipse being confused. Simply clean your project by going to Project -> Clean…Addition
By subtyping MainActivity with EditText, you are inadvertently creating a new, local class named EditText which obscures Android’s EditText class… In general, Activities do not need subtypes. So change this line:
To: