Capture all Ctrl-? under Android

I'm modifying ConnectBot to take advantage of hardware keyboards and I need to capture all Ctrl-? presses. I've disabled all of the alphabetic menu shortcuts (such as Ctrl-C for copy) but the key presses still don't seem to be being received by the onKey event.

I'm fairly new to Android development (literally started today to fix ConnectBot to handle hardware keyboards) and quick Google searching doesn't seem to turn up anything about capturing Ctrl-? key presses.

How do I tell Android to pass these straight through to the onKey handler?


It turns out that the keyCode was set to the correct character value (e.g. 'C'). However, the result of getUnicodeChar() was 0 because CTRL was being held.

All that was needed was to add handling to get the unicode character regardless of the meta-keys that are being held down with:

if (event.isCtrlPressed())
    event = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);

Then later on it was necessary to encode the "CTRL is being held down" information in the key data that was being sent, which was already functionality provided by the ConnectBot code.

Need Your Help

Extended LinearLayout not rotating

android layout rotation

I'm trying to create a custom LinearLayout that can rotate all children in the layout by a set angle. That is, I want to rotate the entire canvas and the children, not the children individually.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.