Ok, here is my solution ...

When the pedal keyEvent is processed in dispatchKeyEvent, send a message to 
the same activity to call requestFocus on the main content view.

Le mardi 14 juillet 2015 17:29:49 UTC+2, Simon Giddings a écrit :
>
> I have integrated the use of Bluetooth pedals, which declare themselves as 
> being a keyboard.
>
> When the pedal is pressed, my activity gets the keypress and, in 
> dispatchKeyEvent, I return true to indicate that I have consumed the 
> event.
> However, the ActionBar is still responding to the keypress by highlighting 
> the title button - I have already set "setDisplayHomeAsUpEnabled" as true.
>
> I then captured the corresponding area in the action bar and removed 
> focusable like this -
>         int iActionBarTitle = 
> getResources().getIdentifier("action_bar_title", "id", "android");
>         View v = findViewById(iActionBarTitle);
>         v = (View)v.getParent().getParent();
>         v.setFocusable(false);
>
> However, this just moved the focus to the first action item.
>
> I do not want to do a lot of hacking so as to avoid further difficulties 
> down the line.
> Not sure of how I can overcome this problem correctly.
>
> Can anyone guide me with this ?
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to