Listener for clipboard content change?

天涯浪子 提交于 2019-12-04 11:01:03

问题


Is there a way to register a method so that it's automatically called as soon as the user ends "text selection mode" (thereby copying selection to clipboard)?


回答1:


I think you're looking for ClipboardManager.addPrimaryClipChangedListener().

Edit - this is for Android 3.0, and I don't see any other clipboard-related apis in the earlier levels.

Also see the ClipboardManager docs in the copy and paste guide.




回答2:


If you are using Android 3.0 you can add a listener with ClipboardManager.addPrimaryClipChangedListener().




回答3:


I need the exact same functionality. For the moment I'm solving this with android.text.ClipboardManager and a java Timer that checks every second if the clipboard-text has changed.



来源:https://stackoverflow.com/questions/5224148/listener-for-clipboard-content-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!