Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - HW key emulation

HW key emulation

Put your problem here if it does not fit any of the other categories.

HW key emulation

Postby mihoelzl » Mon Apr 04, 2011 3:08 pm

Hi,

I am trying to implement a small soft keyboard which should simulate HW key events. There should be an Up-Key, a Down-Key and an OK and Cancel Button.

I made my own InputMethodService which is defined in the Manifest file:
Code: Select all
<service android:name="MyInputMethod"
                android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod" />
            </intent-filter>
            <meta-data android:name="android.view.im" android:resource="@xml/method" />>
        </service>


Inside the service I want to send a KeyEvent to the current Activity. Referring to the Developer Guide I can do this with the following Code:
Code: Select all

      InputConnection ic = getCurrentInputConnection();
      long eventTime = SystemClock.uptimeMillis();
      ic.sendKeyEvent(new KeyEvent(eventTime, eventTime,
      KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_UP, 0, 0, 0, 0,
      KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE));


The Problem here: the InputConnection is null. I tried to manually bind the Service to the activity, start the service, add the Service as Inputmethod to an edittext but nothing seems to work. The InputMethodService does not start in the right LifeCycle.

What am I missing? Any help here?

Thanks,
Michael
mihoelzl
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Apr 04, 2011 3:04 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 12 guests