I’ve taken a program from a book as a template. In activity_main.xml I have:
android:id="@+id/contactID"//and
android:id="@+id/contactName"
both are specified in separate text views.
Then in mainActivity.java I have:
int[] views = new int[] {R.id.contactName, R.id.contactID};
Neither variable is defined in the java file which looks odd to me, but that’s what the book says…and eclipse says neither variable can be resolved or is a field so it won’t compile. It’s the correct contentView.
I’m guessing that R is supposed to pick these up when compiling – it doesn’t. I’ve tried cleaning with no joy. Sorry if I’m missing something really obvious.
Check your import. remove
android.Rif its imported. And import your R. Also make sure that you do NOT have any errors in your xmls, or else your R will not be generated.