I found an answer to my own question. I had to do a couple of things:
1. I needed to make the EditText accept single line input only. I did this in the <EditText> node (I also set the button to "Done"):
android:singLine="true"
android:imeOptions="actionDone"
2. Next, in the onCreate() I added the following after the "myListView.setAdapter(aa);" line:
// Catch the "done" button on softkeyboard
myEditText.setOnEditorActionListener(new EditText.OnEditorActionListener(){
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE){
//done Clicked
addTextToListView(myEditText, todoItems, aa);
return true;
}
return false;
}
});
Special thanks to myself for the answer. You're welcome, myself!
And if anyone wants to add that to the next version of the book then please send me the commission or royalties via PayPal or cheque.
