Android imitation Amoy password copy pop-up box function (short answer version)

The last article introduced the function of Android to open mobile Taobao and automatically identify Taobao password to pop up commodity information. Next, this article shares the function of copying Taobao password pop-up box in Android simple version, hoping to help you!

Use the paste board management service of Android system and clipboardmanager to add a listener through addprimaryclipchangedlistener to monitor the state of the paste board. It is a very simple small function~

1. First create a service to run in the background:

In addition, the content copied from the pasteboard is obtained in onresume(), which is used to restart the app when the app is not started or the service is closed to pop up the password window

2. Paste the service on the service management board:

3. Do what you want in onprimaryclipchanged(), such as pop-up box:

Use WindowManager to display pop-up boxes

Click the pop-up box to jump to activity

Very simple small functions, but there should be some small problems to be solved in the actual application process

OK, let's take a look at the principle of Amoy password: clipboard notes

Clipboard is a system service provided by Android. It provides a global clipboard, making it possible to share text, pictures and data among multiple apps.

The basic use of clipboard is divided into three steps:

Get clipboardmanager:

Copy:

Paste:

Done!

summary

The above is the Android imitation Amoy password copy pop-up box function (short answer version) introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>