Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

yilzer
4,601 Points"activity_main cannot be resolved or is not a field"
Hi guys, i have a problem with this error. Yesterday when i closed eclipse everything worked fine, but when i start eclipse today this error appear: "activity_main cannot be resolved or is not a field"
Can anyone help me out?

yilzer
4,601 PointsIn this line of code:
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } The error is underlined by activity_main and this error appeared in the MainActivity.java. The error appeared when i started eclipse today, when i closed eclipse yesterday everything was fine.
Tnx for helping man
3 Answers

Masum Bergmann
Courses Plus Student 4,129 PointsYou should have the following: (notice .inflate(R.menu.main, menu))
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Hopefully that helps! Let me know!

yilzer
4,601 PointsThanks man! It works fine now!

Masum Bergmann
Courses Plus Student 4,129 PointsMa pleasure my man!
Masum Bergmann
Courses Plus Student 4,129 PointsMasum Bergmann
Courses Plus Student 4,129 PointsWhen do you get that error? and where do you see it?