Error :activity_main Can Not Be Resolved Or Not A Field
getting above error .followed this but didn't find solution.checked my resource file and all but no use suggest me sutable solution for this.here placing the activity_main.xml and
Solution 1:
Change
setContentView(R.id.activity_main);
to
setContentView(R.layout.activity_main);
From the Docs for setContentView()
Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.
If you look in R.java
in the gen
folder, there are different classes. R.id
is for an id
that you give a certain View
. R.layout
is for a layout
file that you create.
setContentVieweither takes a
layoutor a
View. Not an
idof a
View`.
Post a Comment for "Error :activity_main Can Not Be Resolved Or Not A Field"