Thanks Dianne! Good to know, even though it presents a setback.

> Why are you doing this?

For accessibility purposes. One of my blind users just bought an
Alcatel OT-980 running Android 2.1. This phone does have a physical
QWERTY keyboard but no d-pad or equivalent (BTW, the same applies to
Motorola Droid Pro and Sony Ericsson X10 mini pro). So I want to make
provisions for blind navigation of menu and dialogs through Google's
screen reader TalkBack. This currently requires physical keys, because
Android still lacks the kind of touch event model of the iPhone where
(blind) users can explore the screen by touch and hear GUI elements
spoken without immediately activating whatever elements they are
touching or sliding over. This is particularly relevant for the soft
keyboard, but even with Android phones that have a physical keyboard
we face this accessibility problem when there is no d-pad. These users
are motivated enough to learn a few workarounds, because that is part
of their daily life.

Best regards


The vOICe for Android
http://www.seeingwithsound.com/android.htm

On Dec 17, 10:06 am, Dianne Hackborn <hack...@android.com> wrote:
> I doubt you will get this to work correctly, because you are doing this
> after parts of the framework that deal with things like going in and out of
> touch mode have seen the events.
>
> Why are you doing this?  If a device doesn't have a DPAD, the user isn't
> going to think to use the volume keys to navigate focus(!!).  You should be
> giving them a good touch-based UI.
>
> On Fri, Dec 17, 2010 at 12:38 AM, blindfold <seeingwithso...@gmail.com>wrote:
>
>
>
> > For Android phones that lack a physical d-pad or trackball (e.g.
> > Alcatel OT-980, Motorola Droid Pro), I am trying to remap the physical
> > up and down volume keys to simulated up and down d-pad keys using code
> > like
>
> > �...@override
> >   public boolean onKeyDown(int keyCode, KeyEvent event) {
> >      if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
> >         KeyEvent ke = new KeyEvent(KeyEvent.ACTION_DOWN,
> > KeyEvent.KEYCODE_DPAD_UP);
> >         dispatchKeyEvent(ke);
> >         return true;
> >      }
> >      return super.onKeyDown(keyCode, event);
> >   }
>
> > Although this works fine with a ListView and with activity views that
> > become scrollable because they are too large to fit on the physical
> > screen, it somehow does not work at all for activity views that remain
> > small enough to fit on the screen. I can test this by increasing the
> > number of radio buttons in some activity view and then see how the
> > above key remapping begins to work fine as soon as there are more
> > controls than fit on the screen. I have tried all sorts of things with
> > setting focus after making things focusable using setFocusable(true),
> > setFocusableInTouchMode(true), requestFocus(), requestFocusFromTouch()
> > and so on, but nothing seems to help. The above onKeyDown() executes
> > in all relevant cases as shown by my Log.i() output, but it is the
> > dispatchKeyEvent() that  in the described cases does nothing. All my
> > activity views are surrounded by <ScrollView></ScrollView> in the XML
> > of their respective layouts. More about the context of this problem at
>
> >http://groups.google.com/group/eyes-free-dev/browse_thread/thread/374...
> > (eyes-free-dev list).
>
> > So the above code works "sometimes", but I need a reliable/general
> > solution. How can one reliably remap physical keys to perform key
> > functions for which there are no physical keys on the Android device?
>
> > Thanks!
>
> > --
> > 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<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
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