Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
I tried to follow the android tutorial but after I try to run the code this error appears. this code is in my MainActivity.

Java
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);
}


but ERRoR is on this line

Java
EditText editText = (EditText)findViewById(R.id.edit_message);


can not solve "R.id.edit_message"
Posted
Updated 14-Jun-15 5:01am
v3
Comments
Krunal Rohit 14-Jun-15 10:14am    
Clean the solution and Build it again.

-KR
Afzaal Ahmad Zeeshan 14-Jun-15 10:24am    
My virtual 5.

Also see my answer, Solution 1.

i solved it :)))))))))

i shuold add this line in activity_main.xml

"@+id/edit_message"

but in tutrial didn't use this line
 
Share this answer
 
cheack editbox name is given in that xml file both are same or not or mantion or not if both are mismatch and find this type error
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900