Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 126.96.36.199 release ready!
Updated 15 December 2016
Everyone knows the importance of copy and paste in today’s life. Also in many scenarios you have to copy a particular text , image, link etc. in mobile devices as well. Android provide the copy and paste feature through the library of ClipboardManager and ClipData. You can use this library to copy and paste different types of data on your android devices.
For copy you have to make a instance of ClipboardManager and then put the data to be copied on ClipData object then android will put that data onto system wide Clipboard from where you can access that data anywhere in your device. So firstly lets make a ClipData object and add some random data in it like
Now your dummy text is copied to the clipboard you can add a OnLongClickListener on ant text or image then perform all these oprations inside listener. For image the URI is copied on the clipboard.
Now for pasting this dummy text or any other type of data currently in clipboard you have to again instantiate ClipboardManager and then get the data stored/ copied on the clipboard like
Now you have the copied text in String type variable test you can set it anywhere you want. You can again apply OnLongClickListener on any TextView or EditText and set the copied text over there by this method.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.