Dear Sarwar,

Thanks for your reply.

The problem I have is I don't know when the text is selected and
copied into the clipboard after firing the KeyEvent.

Thanks.

On Aug 12, 4:12 pm, Sarwar Erfan <erfanonl...@gmail.com> wrote:
> Use the ClipboardManager to get/set/manipulate the content in the
> clipboard.http://developer.android.com/reference/android/text/ClipboardManager....
>
> Regards
> Sarwar Erfan
>
> On Aug 12, 12:13 pm, Ryan Tan <ryantan...@gmail.com> wrote:
>
>
>
> > 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.- Hide quoted text -
>
> - Show quoted text -

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