Remove item from todoList please help
<p>Need serious help with android todolist anyone could help please. 
I am trying to remove the last item inserted in the list it doesn't work for some reasons. please help if you can see the below:</p>

<p>public class ToDoList extends Activity implements OnClickListener, OnKeyListener {</p>

<pre><code>Button btnRemove;
 ArrayList&lt;String&gt; todoItems;
  ArrayAdapter&lt;String&gt; aa;
  ListView myListView ;
  EditText myEditText ;
</code></pre>

<p>@Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);</p>

<pre><code>// Inflate your view
  setContentView(R.layout.main);

  // Get references to UI widgets
   myListView = (ListView)findViewById(R.id.myListView);
   myEditText = (EditText)findViewById(R.id.myEditText);  

  // Create the ArrayList and the ArrayAdapter
 todoItems = new ArrayList&lt;String&gt;();
  aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,todoItems);

  // Bind the listview to the array adapter
  myListView.setAdapter(aa);

  btnRemove = (Button)findViewById(R.id.btnRemove);

// Add key listener to add the new todo item
  // when the middle D-pad button is pressed.
  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) {
        // Add the new todo item, and clear the input text box
        todoItems.add(0, myEditText.getText().toString());
        myEditText.setText("");
        aa.notifyDataSetChanged();
        return true;
      }
    return false;
  }
});
</code></pre>

<p>}</p>

<p>@Override
public void onClick(View v) {
    if(v == btnRemove){
        if(todoItems.size() > 0){
            todoItems.remove(todoItems.size() - 1);
            aa.notifyDataSetChanged();
        }</p>

<p>}
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // TODO Auto-generated method stub
    return false;
}</p>

<p>}</p>
