cannot resolve symbol ‘editText’

public void sendMessage(View view) {
    // Do something in response to button
    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);

I just started Android prog! so i am following this guide “Start Another Activity” fro google: https://developer.android.com/training/basics/firstapp/starting-activity.html Error occurs in this line EditText editText = (EditText) findViewById(R.id.editText); In the “(R.id.editText)” part! so if someone can explain why & how am getting this error it will be greately helpful! Thanks in advance!

Leave a Comment