gpt4 book ai didi

java - Andengine 新 Activity - list

转载 作者:行者123 更新时间:2023-11-30 09:32:07 24 4
gpt4 key购买 nike

我想用这段代码开始我的 Level1.class Activity :

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: mainandroid.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)

我如何在 list 文件中定义 Activity ?

最佳答案

AndriodManifest.xml 文件中为 Level1.class 添加 Activity...

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

查看 this answer有关指定名称属性的更多详细信息。

关于java - Andengine 新 Activity - list ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12622499/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com