I'm currently working on project, Android Internet Download Manager. In order to download the file, the user has to copy the URL that he wants to download. What I need is the code to acquire the copied URL from the clipboard, so that I can download that particular file I acquired from the clipboard. Thank you in advance.
Asked
Active
Viewed 1,669 times
1 Answers
1
You should be able to use this:
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
String textOnClipboard = clipboard.getText();
Then you can check if it is indeed a URL, and continue parsing from there. You may want to review the documentation on ClipboardManager
.

Cat
- 66,919
- 24
- 133
- 141
-
Or have a look at the Copy and Paste documentation: https://developer.android.com/guide/topics/text/copy-paste.html#framework – Dirk Jäckel Jun 23 '12 at 18:20