2

I want to start my Level1.class Activity with this code:

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();
    }
});

However, I get this error message:

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)

How I define the activity in my manifest file?

Rob
  • 5,223
  • 5
  • 41
  • 62
aniug
  • 31
  • 1

1 Answers1

2

Add Activity for Level1.class in your AndriodManifest.xml file...

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

Check out this answer for additional details on specifying the name attribute.

Community
  • 1
  • 1
Priyank Patel
  • 12,244
  • 8
  • 65
  • 85
  • @aniug This looks relevant: http://stackoverflow.com/questions/3608017/activity-name-in-androidmanifest-xml – Rob Sep 27 '12 at 13:55