> That should happen automatically, without implementing onKeyDown().

Without implementing onKeyDown the back button will close my
application.

> > Thus, I implemented the onKeyDown method.
>
> Where? On the activity? On a subclass of one of the widgets?

On the activity: from this activity I want to go back to a parent
activity (which extends ActivityGroup).
As already said I have a problem only when the list is empty. It seems
to me that this happens when the list isn't focused, but again, when
it is empty, list.requestFocus() doesn't solve my problem...

On 26 Mai, 17:50, "Mark Murphy" <mmur...@commonsware.com> wrote:
> > I have a proble with onKeyDown:
> > my activity consists in a simple textView (as header) and a ListView
> > below it, I need to go back to the previous screen when the user
> > presses the back button.
>
> That should happen automatically, without implementing onKeyDown().
>
> > Thus, I implemented the onKeyDown method.
>
> Where? On the activity? On a subclass of one of the widgets?
>
> > Everything works fine if the
> > list contains some elements, but when the list is empty the onKeyDown
> > method is never called...
>
> I would just get rid of it and allow Android to handle the back button,
> since Android's default behavior seems to be what you want.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to