开发者

Can I hook when user copy or paste on TextView?

When user copy or paste on TextView, Is there anyone explains me what happen on TextView. If some methods called while user click 'Copy' or 'Paste' in menus, I'd like to hook them and replace them with my own one.

Here is what I want to do. 1. user copy or paste some string to my TextVi开发者_如何学编程ew. 2. some string copied and paste on my Textview. 3. Before some string is added on Textview, I want to check or change string.


You should be able to do this with the onTextContextMenuItem() method checking for copy or paste.

Alternatively you can use a TextWatcher to monitor changes in a TextView but this doesn't differentiate between typing and cutting and pasting. Add a TextWatcher with the addTextChangedListener() method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜