With a simple keyboard accessory, a tablet becomes a decent approximation of a netbook (which might be part of the reason they seem to be eating into that market). The problem is that not many Android developers make use of keyboard shortcuts in their apps, and this got me wondering:
- Does Android allow for keyboard shortcuts?
- Is it hard to code into your app?
The answers are:
Elaborating on question 2: In an Android activity, there is an onKeyShortcut method that one can override to provide global keyboard shortcuts for that Activity. Below follows a small example:
The above example only takes care of a single shortcut for Ctrl+B, but more cases can be added for more shortcuts. The event paramater can also be used to check if other meta-keys are pressed, which allows for a wide variety of keyboard shortcuts.
This shows that it’s not particularly hard to add keyboard shortcuts to your app, and they really are useful for your (slightly) more advanced users.