Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 3rd, 2009, 06:22 PM
Authorized User
Join Date: Mar 2009
Posts: 21
Thanks: 0
Thanked 3 Times in 3 Posts
Default Chap 2 ToDoList - Stopped Unexpectedly

I hope I didn't miss something basic, but my first attempt to run the ToDoList in Chapter 2 results in: "Sorry! The application To Do List has stopped unexpectedly. Please try again.". I assume there's an exception somewhere, but I'm too much of a novice to diagnose it.

package com.paad.todolist;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.view.View.*;
import android.widget.*;

public class ToDoList extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle icicle) {
        // Inflate your view
        // Get references to UI widgets
        ListView myListView = (ListView)findViewById(R.id.myListView);
        final EditText myEditText = (EditText)findViewById(R.id.myEditText);
        // Create the array list of to do items
        final ArrayList<String> todoItems = new ArrayList<String>();
        // Create the array adapter to bind the array to the listview
        final ArrayAdapter<String> aa;
        aa = new ArrayAdapter<String>(this,
        // Bind the array adapter to the listview
        myEditText.setOnKeyListener(new OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (event.getAction() == KeyEvent.ACTION_DOWN)
                    if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
                        todoItems.add(0, myEditText.getText().toString());
                        return true;
                return false;
Reply With Quote
  #2 (permalink)  
Old March 4th, 2009, 01:14 PM
Authorized User
Join Date: Mar 2009
Posts: 21
Thanks: 0
Thanked 3 Times in 3 Posts

I actually found the reason for my program crashing. I had dropped the call to:


from my method since the book didn't include this in the source code. Although the Eclipse template creates this call, I took the book's code literally which might confuse some readers in this case.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4 - customizing ToDoList - ruled lines not working correctly gregking BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 April 3rd, 2009 09:44 AM
HttpWebRequest - The connection was closed unexpectedly herrbanan C# 2005 4 January 20th, 2009 03:59 AM
ASP WebMatrix closes unexpectedly asp_princess ASP.NET 1.0 and 1.1 Basics 0 June 28th, 2007 09:36 AM
Reporting Server down unexpectedly japjit Reporting Services 1 January 11th, 2007 12:47 AM
access unexpectedly quit message ithunter Access 0 December 1st, 2004 12:32 PM

All times are GMT -4. The time now is 08:45 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.