In the main.xml i have :
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Your total is 0"
android:textSize="45dp"
android:layout_gravity ="center"
android:gravity = "center"
android:id="@+id/tvDisplay"
/>
<Button
android:layout_width="250dp"
android:layout_height="250dp"
android:text = "+"
android:layout_gravity="center"
android:textSize = "20dp"
android:id="@+id/bAdd"
/>
<Button
android:layout_width="250dp"
android:layout_height="250dp"
android:text = "-"
android:layout_gravity="center"
android:textSize = "20dp"
android:id="@+id/bSub"
/>
And in the main body i have:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
counter = 0;
add = (Button) findViewById(R.id.bAdd);
sub = (Button) findViewById(R.id.bSub);
display = (TextView) findViewById(R.id.tvDisplay);
It cites the (R.id.bAdd/Sub/Display) that it cannot be resolved or is not a field. I've been following a youtube guide on how to do this exactly, so i'm confused as to how i have an error, and how i correct it.
R.java is extremely finicky in Eclipse. If you haven't tried cleaning the project, restarting Eclipse, etc, try that. Is R.java found in your gen folder? Are other variables that should be found in R also unable to be resolved or are those the only ones? If all else fails you can try deleting R.java and cleaning the project, and assuming your XML doesn't contain errors it should re-generate.
Check to see if java.R is being imported at the top of the .java file where you're having the issues. None of the other solutions worked for me, but this did. If it is being imported, you should have a yellow warning. Remove the line, and don't import it.