title: R.id.myEditText error // todolist attempt
body: <p>Hey guys, 
  i bought an android dev book from WROX (Android 2 application development) and on chapter 2 they have an average task list project that i can't seem to get working.</p>
  
  <p>I copied the exact line of code and tried tweaking them to get it to work but the following line remains an error no matter what i do.</p>
  
  <pre><code>final EditText myEditText = (EditText) findViewById(R.id.myEditText);
  </code></pre>
  
  <p>the error is the <code>R.id.myEditText</code>, i've added it to the R.java file but no luck it doesn't want to work.</p>
  
  <p>the java file for it is the following.</p>
  
  <hr>
  
  <pre><code>package com.paad.todolist;
  
  import java.util.ArrayList;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.KeyEvent;
  import android.view.View;
  import android.view.View.OnKeyListener;
  import android.widget.ArrayAdapter;
  import android.widget.EditText;
  import android.widget.ListView; 
  
  public class ToDoList extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);  
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.main);
  
      ListView myListView = (ListView) findViewById(R.id.myListView);
      final EditText myEditText = (EditText) findViewById(R.id.myEditText);
  
      final ArrayList&lt;String&gt; todoItems = new ArrayList&lt;String&gt;();
  
      final ArrayAdapter&lt;String&gt; aa;
      aa = new ArrayAdapter&lt;String&gt;(this,
              android.R.layout.simple_list_item_1, todoItems);
  
      myListView.setAdapter(aa);
  
      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());
                      aa.notifyDataSetChanged();
                      myEditText.setText("");
                      return true;
                  }
              return false;
          }
      });
  }
  
  }
  </code></pre>
  
  <hr>
  
  <h2>the XML file is the follwing</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      &gt;
  &lt;TextView
      android:id="@+id/myTextView"
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/hello"
      /&gt;
  &lt;ListView
      android:id="@+id/myListView"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" 
      /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <hr>
  
  <p>Any ideas?</p>