I have the same issue as you. I am stuck on this application as it
appears the OnKeyListener does not work for some reason. I tried to
set the text also, but it never gets executed. I also ran the sample
application with the same result.
I am a little miffed to say the least that the applications provided
in a relatively new book do not work. If anyone has experience with
this could they help?
Thanks
Mat
On Dec 8, 3:18 pm, pnball2k <[EMAIL PROTECTED]> wrote:
> I'm working on some sample programs in the Professional Android
> Applications book and was trying to run the debugger in Eclipse. When
> I do, I do not see the results of a line the should change the text in
> the emulator. I put a line in the code "myEditText.setText("Testing
> 123");" and expect to see that value when I execute that line in the
> code. I do not have any errors ort messages in Eclipse.
>
> I do know the line is functioal because "Testing 123" is set in a
> ListView later in the code. Look for the comment "HERE IS THE LINE I
> ADDED"
>
> The code is:
>
> 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.
> // HERE IS THE LINE I ADDED
> myEditText.setText("Testing 123");
> todoItems.add(0, myEditText.getText().toString());
> myEditText.setText("");
> aa.notifyDataSetChanged();
> return true;
> }
> return false;
> }
> });
>
> What am I doing incorrectly?
>
> Thanks
> Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---