How to set selection of editText by using SendKeyEvent function of InputConnection class

by DrBrain » Thu, 30 Apr 2009 02:06:02 GMT


Sponsored Links
 I need to set selection of an editText box via InputConnection. I used
the SendKeyEvent function with the KEYCODE_DPAD_LEFT and META_SHIFT_ON
state but I've had no luck. My code is as below:

...
// I've already received hardware key event of DPAD left key as event
parameter in this function.

// Change the meta state of event parameter to META_SHIFT_ON
event = new KeyEvent(event.getDownTime(), event.getEventTime(),
                        event.getAction(), event.getKeyCode(), 
event.getRepeatCount(),
KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE|
KeyEvent.META_SHIFT_LEFT_ON|KeyEvent.META_SHIFT_ON,
                        event.getDeviceId(), event.getScanCode());
InputConnection ic = getCurrentInputConnection();
ic.sendKeyEvent(event);

After excuting the code, there still no selection in the EditText.

Could somebody help me to resolve this ?

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Setting for "Use incoming call volume for notifications"

Hi All-

Does anyone know where the value for "Use incoming call volume for
notifications" is stored?

This is a checkbox found in the Ringer Volume settings that allows you
to set a separate notification volume and incoming call volume.  I
would like to programatically toggle the value, but I can't figure out
where it's stored.  I looked at Context.AudioManager, I see methods
for controlling the notification volume, but I can't find a setting
for separating notification volume from incoming call volume.

Thanks!

-- 

2. Video Playback freezes on 1.6 donut with opencore2

It looks like there is something wrong with the player (opencore), at
times, video playback will get stuck on one frame, and will stay there
for a long time.

If you look at the log, you can see that player started playing at
17:59:48, at that time it has already buffered 6 seconds of video.
Then at 17:59:53 the video and sound got stuck, while buffering kept
going on in the background

After 25 seconds (18:00:19) it resumed playing and buffer was already
at 36 seconds, and all this time the api report that it is playing,
meaning in the code, i don't know that video is stuck...

Any thoughts or suggestions? This started to happen in donut (1.6)
with the introduction of opencore2. I have never seen this problem in
with previous version of opencore (android versions <= 1.5)

Legend: the integers next to "current" and "buffer" are in seconds of
video. while "playerDriver buffering" are in percentages.


12-18 17:59:48.529 D/dalvikvm(19121): GC freed 4446 objects / 813696
bytes in 294ms
12-18 17:59:48.589 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 0 buffer: 4 playing?true
12-18 17:59:49.109 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 0 buffer: 4 playing?true
12-18 17:59:49.269 D/PlayerDriver(18730): buffering (5)
12-18 17:59:49.619 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 1 buffer: 5 playing?true
12-18 17:59:50.119 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 1 buffer: 5 playing?true
12-18 17:59:50.279 D/PlayerDriver(18730): buffering (6)
12-18 17:59:50.619 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 2 buffer: 6 playing?true
12-18 17:59:51.119 V/RhythmClipBrowser(19121): channels count: 20
12-18 17:59:51.249 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 3 buffer: 6 playing?true
12-18 17:59:51.619 D/PlayerDriver(18730): buffering (7)
12-18 17:59:51.759 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 3 buffer: 7 playing?true
12-18 17:59:52.269 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 4 buffer: 7 playing?true
12-18 17:59:52.719 D/PlayerDriver(18730): buffering (7)
12-18 17:59:52.779 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 4 buffer: 7 playing?true
12-18 17:59:52.939 D/PlayerDriver(18730): buffering (8)

----->>>>>> VIDEO FREEZES HERE,

12-18 17:59:53.289 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 8 playing?true
12-18 17:59:53.794 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 8 playing?true
12-18 17:59:54.301 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 8 playing?true
12-18 17:59:54.724 D/PlayerDriver(18730): buffering (8)
12-18 17:59:54.809 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 8 playing?true
12-18 17:59:55.314 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 8 playing?true
12-18 17:59:55.621 D/PlayerDriver(18730): buffering (9)
12-18 17:59:55.819 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:56.325 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:56.719 D/PlayerDriver(18730): buffering (9)
12-18 17:59:56.829 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:57.340 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:57.849 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:58.353 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:58.730 D/PlayerDriver(18730): buffering (9)
12-18 17:59:58.859 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:59.363 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 9 playing?true
12-18 17:59:59.849 D/PlayerDriver(18730): buffering (10)
12-18 17:59:59.869 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 10 playing?true
12-18 18:00:00.371 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 10 playing?true
12-18 18:00:00.879 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 10 playing?true
12-18 18:00:01.119 D/PlayerDriver(18730): buffering (11)
12-18 18:00:01.349 I/ActivityManager(   73): Start proc
com.android.calendar for broadcast
com.android.providers.calendar/.CalendarAppWidgetProvider: pid=19211
uid=10021 gids={3003}
12-18 18:00:01.379 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 11 playing?true
12-18 18:00:01.679 I/dalvikvm(19211): De{*filter*} thread not active,
ignoring DDM send (t=0x41504e4d l=38)
12-18 18:00:01.729 I/dalvikvm(19211): De{*filter*} thread not active,
ignoring DDM send (t=0x41504e4d l=44)
12-18 18:00:01.749 I/ActivityThread(19211): Publishing provider
calendar: com.android.providers.calendar.CalendarProvider
12-18 18:00:01.889 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 11 playing?true
12-18 18:00:02.049 D/PlayerDriver(18730): buffering (12)
12-18 18:00:02.399 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 12 playing?true
12-18 18:00:02.889 D/PlayerDriver(18730): buffering (13)
12-18 18:00:02.899 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 13 playing?true
12-18 18:00:03.359 D/PlayerDriver(18730): buffering (14)
12-18 18:00:03.369 I/ActivityManager(   73): Stopping service:
com.android.providers.calendar/.CalendarAppWidgetService
12-18 18:00:03.399 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 14 playing?true
12-18 18:00:03.909 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 14 playing?true
12-18 18:00:04.170 D/PlayerDriver(18730): buffering (15)
12-18 18:00:04.409 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 15 playing?true
12-18 18:00:04.756 D/PlayerDriver(18730): buffering (16)
12-18 18:00:04.915 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 16 playing?true
12-18 18:00:05.209 D/PlayerDriver(18730): buffering (17)
12-18 18:00:05.420 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 17 playing?true
12-18 18:00:05.679 D/PlayerDriver(18730): buffering (18)
12-18 18:00:05.923 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 18 playing?true
12-18 18:00:06.326 D/PlayerDriver(18730): buffering (19)
12-18 18:00:06.429 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 20 playing?true
12-18 18:00:06.931 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 20 playing?true
12-18 18:00:07.075 D/PlayerDriver(18730): buffering (20)
12-18 18:00:07.435 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 21 playing?true
12-18 18:00:07.699 D/PlayerDriver(18730): buffering (21)
12-18 18:00:07.940 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 22 playing?true
12-18 18:00:08.296 D/PlayerDriver(18730): buffering (22)
12-18 18:00:08.445 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 23 playing?true
12-18 18:00:08.950 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 23 playing?true
12-18 18:00:08.989 D/PlayerDriver(18730): buffering (23)
12-18 18:00:09.450 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 24 playing?true
12-18 18:00:09.796 D/PlayerDriver(18730): buffering (24)
12-18 18:00:09.959 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 25 playing?true
12-18 18:00:10.465 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 25 playing?true
12-18 18:00:10.552 D/PlayerDriver(18730): buffering (25)
12-18 18:00:10.970 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 26 playing?true
12-18 18:00:11.319 D/PlayerDriver(18730): buffering (26)
12-18 18:00:11.475 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 27 playing?true
12-18 18:00:11.981 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 27 playing?true
12-18 18:00:12.089 D/PlayerDriver(18730): buffering (27)
12-18 18:00:12.490 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 28 playing?true
12-18 18:00:12.936 D/PlayerDriver(18730): buffering (28)
12-18 18:00:12.999 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 29 playing?true
12-18 18:00:13.500 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 29 playing?true
12-18 18:00:13.694 D/PlayerDriver(18730): buffering (29)
12-18 18:00:14.004 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 30 playing?true
12-18 18:00:14.476 D/PlayerDriver(18730): buffering (30)
12-18 18:00:14.509 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 31 playing?true
12-18 18:00:15.009 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 31 playing?true
12-18 18:00:15.239 D/PlayerDriver(18730): buffering (31)
12-18 18:00:15.519 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 32 playing?true
12-18 18:00:15.956 D/PlayerDriver(18730): buffering (32)
12-18 18:00:16.024 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 33 playing?true
12-18 18:00:16.529 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 33 playing?true
12-18 18:00:16.739 D/PlayerDriver(18730): buffering (33)
12-18 18:00:17.031 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 34 playing?true
12-18 18:00:17.499 D/PlayerDriver(18730): buffering (34)
12-18 18:00:17.531 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 35 playing?true
12-18 18:00:18.039 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 35 playing?true
12-18 18:00:18.179 W/AudioFlinger(18730): write blocked for 86 msecs
12-18 18:00:18.369 D/PlayerDriver(18730): buffering (35)
12-18 18:00:18.539 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 5 buffer: 36 playing?true


----->>>>>> VIDEO RESUMES HERE,

12-18 18:00:19.049 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 6 buffer: 36 playing?true
12-18 18:00:19.479 D/PlayerDriver(18730): buffering (36)
12-18 18:00:19.549 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 6 buffer: 37 playing?true
12-18 18:00:20.059 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 7 buffer: 37 playing?true
12-18 18:00:20.549 D/PlayerDriver(18730): buffering (37)
12-18 18:00:20.559 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 7 buffer: 39 playing?true
12-18 18:00:21.069 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 8 buffer: 39 playing?true
12-18 18:00:21.569 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 8 buffer: 39 playing?true
12-18 18:00:21.689 D/PlayerDriver(18730): buffering (38)
12-18 18:00:22.079 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 9 buffer: 40 playing?true
12-18 18:00:22.579 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 9 buffer: 40 playing?true
12-18 18:00:22.719 D/PlayerDriver(18730): buffering (38)
12-18 18:00:23.029 D/PlayerDriver(18730): buffering (39)
12-18 18:00:23.079 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 10 buffer: 41 playing?true
12-18 18:00:23.589 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 10 buffer: 41 playing?true
12-18 18:00:24.089 V/UpdatedMediaPlayerActivity(19121): update
progress, current: 11 buffer: 41 playing?true

-- 

3. layouts, Widgets, MediaPlayer and Video Player

4. Get the list of discovered bluetooth

5. 0xdroid new release beagle-donut-0x3

6. AudioTack

7. just another android rtp stack question