Saturday, 8 May 2010

Firing up a new screen

In my application, I want a main menu with a set of buttons on it. Each button fires up a new screen. In Android you need to use an "Intent" to launch a new screen (which is just another Activity).

I've skim read around the subject on

Picked up the sample code :
Intent intent = new Intent(this, SetupMenu.class);
Dropped this in to my onClick() method.

The class "SetupMenu" is a bog standard activity with a simple layout.

When I tried running this, I got an error in logcat:-

05-08 20:58:18.226: ERROR/AndroidRuntime(936): android.content.ActivityNotFoundException: Unable to find explicit activity class {};
have you declared this activity in your AndroidManifest.xml?

OK, so I forgot to define my Activity in the AndroidManifest.xml file. When I fixed that, the new screen fired up when I clicked on the button that I wired it up to.

Phew! That was a lot easier than getting the ListView & Checkbox thing working.

No comments:

Post a Comment