老实说,我不明白这个错误。我有多个类,字面上完全相同的代码,但由于某种原因,eclipse只是不喜欢这个类。错误发生在 menu.loadResources()和 menu.create()
public void showSplash() {
Debug.i("Scene: Splash");
final SplashScene splash = new SplashScene();
setCurrentScene(splash);
splash.loadResources();
splash.create();
res.engine.setScene(splash);
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
long timestamp = System.currentTimeMillis();
// TODO later load common resources here
MenuScene menu = new MenuScene();
menu.loadResources();
menu.create();
loadingScene = new LoadingScene();
loadingScene.loadResources();
loadingScene.create();
// we want to show the splash at least SPLASH_DURATION miliseconds
long elapsed = System.currentTimeMillis() - timestamp;
if (elapsed < MainActivity.SPLASH_DURATION) {
try {
Thread.sleep(MainActivity.SPLASH_DURATION - elapsed);
} catch (InterruptedException e) {
Debug.w("This should not happen");
}
}
setCurrentScene(menu);
res.engine.setScene(menu);
splash.destroy();
splash.unloadResources();
return null;
}
}.execute();
}
MenuScene类:
public class MenuScene extends AbstractScene{
@Override
public void loadResources() {
// TODO Auto-generated method stub
}
@Override
public void create() {
getBackground().setColor(Color.RED);
}
@Override
public void unloadResources() {
// TODO Auto-generated method stub
}
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void onPause() {
// TODO Auto-generated method stub
}
@Override
public void onResume() {
// TODO Auto-generated method stub
}
}
但是,我还有另一个类几乎完全相同的代码,它不会给我一个错误:
public class SplashScene extends AbstractScene{
@Override
public void loadResources() {
// TODO Auto-generated method stub
}
@Override
public void create() {
getBackground().setColor(Color.PINK);
}
@Override
public void unloadResources() {
// TODO Auto-generated method stub
}
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void onPause() {
// TODO Auto-generated method stub
}
@Override
public void onResume() {
// TODO Auto-generated method stub
}
}
有什么想法吗? 肿块吗?我真的需要帮助找出问题所在