Reputation: 120
I've began making a new project and just as I was linking my buttons to the java I noticed my R would not resolve and come to find out that my R.java file is not there. I've looked at other questions like this and they say to clean the project which I have done and it still does not work. Here is my code from the pages where it wont resolve. Thanks!
Invoice Java
package com.invoice;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class InvoiceActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread logoTimer = new Thread(){
public void run(){
try{
sleep(5000);
Intent menuIntent = new Intent("com.invoice.MENU");
startActivity(menuIntent);
} catch (InterruptedException e) {
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}
}
Job.java
package com.invoice;
import android.app.Activity;
import android.os.Bundle;
public class Job extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.job);
}
}
menu.java
package com.invoice;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class menu extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button job = (Button) findViewById(R.id.button4);
job.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent("com.invoice.job"));
}
});
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
}
Upvotes: 0
Views: 914
Reputation: 864
You probably have problem in resource folder, first solve that error.numeric name of image can generate errors.After solving the errors just clean your project or Build your Project. R.java build again if error is fixed.
Upvotes: 0
Reputation: 3349
You probably have an error in an xml file. R.java will not be generated if there are xml errors. Look through you Manifest.xml and all your layout, values, and any other xml files in res.
Once you have found and fixed the error, clean the project.
Upvotes: 2