我开始制作一个新项目,就在我将按钮链接到 java 时,我注意到我的 R 无法解析并发现我的 R.java 文件不存在。我看过其他类似的问题,他们说要清理我所做的项目,但它仍然不起作用。这是我无法解决的页面中的代码。谢谢!
发票 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();
}
}
作业.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);
}
}
菜单.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();
}
}