嘿,伙计们,谢谢你们的回答,我真的是安卓编程的新手(我今天开始),当我试图构建一个5秒后弹出的具有启动背景的应用程序时,它会给我各种各样的错误,包括一些文件没有出现,以及"跳过48帧!"我会在这里发布错误
07-16 21:29:23.119: E/Trace(641): error opening trace file: No such file or directory (2)
07-16 21:29:23.309: D/dalvikvm(641): GC_FOR_ALLOC freed 73K, 3% free 8051K/8259K, paused 44ms, total 46ms
07-16 21:29:23.309: I/dalvikvm-heap(641): Grow heap (frag case) to 8.497MB for 614416-byte allocation
07-16 21:29:23.390: D/dalvikvm(641): GC_CONCURRENT freed 1K, 3% free 8650K/8903K, paused 33ms+16ms, total 79ms
07-16 21:29:23.709: I/Choreographer(641): Skipped 42 frames! The application may be doing too much work on its main thread.
07-16 21:29:23.770: D/gralloc_goldfish(641): Emulator without GPU emulation detected.
07-16 21:29:29.019: I/Choreographer(641): Skipped 48 frames! The application may be doing too much work on its main thread.
这是main.java
公共类Main扩展活动{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Thread logoTimer = new Thread(){
public void run(){
try{
sleep(5000);
Intent menuIntent = new Intent("com.kamath.thebasics.MENU");
startActivity(menuIntent);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
和菜单.java
公共类菜单扩展活动{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
}
试试这个(在主活动的onCreate中):
Thread myThread = new Thread(){
public void run(){
try{
sleep(5000);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent menuIntent = new Intent("com.kamath.thebasics.MENU");
startActivity(menuIntent);
}
}
};
myThread.run();
也许这会有所帮助。