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 http://developer.android.com/

Picked up the sample code :
Intent intent = new Intent(this, SetupMenu.class);
startActivity(intent);
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 {com.kalugin.android/com.kalugin.android.SetupMenu};
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.

Starting Android Development

This is a blog to track stuff I work out when doing Android development.

The first thing I've found out - Android Development is not straight forward!!!

There's a new application framework paradigm to understand. I've done Visual C++ with MFC classes; X-Windows user interfaces; Java Swing; Web from CGI to JSPs; Java Mobile dev.

Android is another new paradigm.

So far I've been working on my first Android app for 3 weeks (in my spare time). 2.5 weeks was spent working out how to get CheckBoxes working in a ListView/ListActivity.

Tip: Sign up to the Google Group for Android Dev!