0

I want to open dialog in my app like google translator open when word selected and we copy it in any pdf reader or web browser. Please check below screen shot I want to open like as below

enter image description here

Narendra Motwani
  • 1,085
  • 10
  • 20

1 Answers1

0

What you would need to do here is run a background service from within your application that can constantly monitor the state of the clipboard. As soon as some content is copied on the clipboard, you can create the Dialog.

To display the dialog over any other application, please go through this answer: https://stackoverflow.com/a/2147318/3286614

PS: To keep the service running constantly, you can send a broadcast from the onDestroy of the Service. You can then register the BroadcastReceiver for this broadcast, and within the receiver, you can launch the service again. This way, even if your service dies, it will be relaunched.

Community
  • 1
  • 1
Rachit
  • 3,173
  • 3
  • 28
  • 45