Hi, I am using a WebView to display some text. I want to allow the
users to be able to select a word (or even a character) and take some
action on it (for example, look up the dictionary).

So far, I have only found the following code that can enable text
selection in a WebView:

KeyEvent shiftPressEvent = new
KeyEvent(0,0,KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT,0,0);
shiftPressEvent.dispatch(myWebView);

The above code will trigger the text selection mode in a WebView and
copy the selected text automatically into the clipboard. However, I
have no idea how I can act on the selected text when it is copied into
the clipboard. Any ideas on how I can detect that some text is copied
into the clipboard and act on it (without user interaction)?

If not, are there any other ways that I can allow users to select a
character/word in the WebView and perform some operation on it?

Thank you for your ideas.

-- 
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

Reply via email to