I am teaching myself how to write an android application in eclipse. I have the following content in R.Java
public static final class menu {
public static final int activity_marblez_main=0x7f060000;
}
However, in my main java file, I can’t seem to “see” my objects in R.java.
package com.example.marblez;
import android.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class MarblezMain extends Activity {
//Custom View for Marble View
private MarblezView mView;
//ID for the menu exit option
private final int ID_MENU_EXIT = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mView = new MarblezView(getApplicationContext(), this);
mView.setFocusable(true);
setContentView(R.layout.activity_marblez_main);
}
My problem is that when I write the line:
setContentView(R.layout.activity_marblez_main);
It still can’t see activity_marblez_main. I have imported the R.Java file. I have deleted it and regenerated it, but it can’t fine “activity_marblez_main”. Why? The specific error is:
"activity_marble_main cannot be resolved or is not a field"
I also cannot, for that matter, read anything else from the R.java file such as strings or anything. Does anyone know what could be causing this error. I am tearing my hair out. I know computers don’t lie, but I am seeing everything where it should be and it is just like the program just won’t read it?
Remove this line
as you are importing platform’s R file, not yours, which should be:
(but you also can have none, which is OK). You can re-generate imports in Eclipse by pressing CTRL–SHIFT–O (letter “o”). Just ensure you got no platform R imported.