2012-09-27 68 views
2

我要開始我的Level1.class活動與此代碼:Andengine新的活動 - 清單

public class OverviewChapter1 extends Scene 

SceneManager.mainScene.runOnUiThread(new Runnable() 
{ 
    public void run() 
    { 
     SceneManager.mainScene.startActivity(new Intent(SceneManager.mainScene, Level1.class)); 
     SceneManager.mainScene.finish(); 
    } 
}); 

不過,我得到這個錯誤信息:

 
FATAL EXCEPTION: main 
android.content.ActivityNotFoundException: Unable to find explicit activity class 
{de.davidtheobald.thorsrevengeapp/de.davidtheobald.thorsrevengeapp.chapter1.Level1}; 
have you declared this activity in your AndroidManifest.xml? 
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1511) 
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1387) 
    at android.app.Activity.startActivityForResult(Activity.java:3195) 
    at android.app.Activity.startActivity(Activity.java:3302) 
    at de.davidtheobald.thorsrevengeapp.chapter1.OverviewChapter1$1$1.run(OverviewChapter1.java:89) 
    at android.os.Handler.handleCallback(Handler.java:605) 
    at android.os.Handler.dispatchMessage(Handler.java:92) 
    at android.os.Looper.loop(Looper.java:137) 
    at android.app.ActivityThread.main(ActivityThread.java:4511) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:511) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 
    at dalvik.system.NativeStart.main(Native Method) 

如何定義我在我的活動清單文件?

回答

2

添加活動Level1.classAndriodManifest.xml文件...

<activity android:name="YourPackage.Level1"> </activity> 

退房this answer有關指定name屬性的其他詳細信息。

+0

@aniug這看起來相關:http://stackoverflow.com/questions/3608017/activity-name-in-androidmanifest-xml – Rob

+0

謝謝robjb :) 沒有「。」在開始時它工作。 – aniug