Sorry, it was not Chapter 2 (like I wrote in the text). It was rather in Chapter 4 (like I wrote in the headline) where you have shown how to modify existing views. The same code works for me with Android 2.1, but not with 1.6.
I think it has something to do with the XML-Layout files. Because when I debugged the code there was nothing wrong in JAVA Code. The error arrives after calling the method "notifyDataSetChanged" (aa is the name of the ArrayAdapter):
Code:
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 a new todo item and clear the input box.
todoItems.add(0, myEditText.getText().toString());
myEditText.setText("");
aa.notifyDataSetChanged();
return true;
}
return false;
}
});
The debugger identifies an error of the PhoneLayoutInflater when the method "ArrayAdapter.createViewFromResource(...)" is called.
I hope I could describe my question/problem in a more understandable way. Thanks for help.