Reputation: 693
Hello i can't import the R with the layouts resources from my app this is the code i followed exactly how i find it but eclipse won't run the application
package menu.packg;
import android.app.Activity;
import android.os.Bundle;
import android.widget.*;
import menu.packg.R;
public class Menuactivity extends Activity{
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Upvotes: 0
Views: 1067
Reputation: 10550
You shouldn't have to import your R.java
file at all. It is automatically generated (if you have valid XML) and taken care of for you.
Upvotes: 1
Reputation: 468
Also, from my experience sometimes if you have a problem with your layout, the build will NOT complete and hence R.java
will not be generated properly.
Are you sure your layouts don't have errors?
Upvotes: 1
Reputation: 23606
R is automatically generated. But still if you want to create R.java in your gen directory then try to use this.
-> Right click on the Respective Project Folder in eclipse
-> Click Properties, then select Java Build Path, then select source
-> Now select Add Folder at right side of that window,
-> Select on gen folder -> then select Ok, again Ok.
Now you will get that respective gen package of the Project. Now try to clean the project.
Hope it will help you. I have done like this and it helps me a lot.
Enjoy.
:)
Upvotes: 2
Reputation: 2029
My panic list for R generation problems
Upvotes: 1