I want to copy images/files to clipboard. I have googled it but i didn\'t find any alternative/suggestion to this. but i have seen some app\'s done in app store. want to kno
Android ClipData.Item supports only Text & Uri. So you can't acheive copying of image data over clipboard.
One possible solution can be to save image data in some sort of Storage and copy Content URI of the same. However this will not make life easier for you, as data copied will be available to all editors which can get data from ClipboardManager, They might not know how to handle this type of Data.
If you want to copy/paste in your apps, then i will suggest you to write your own version of ClipboardManager and do whatever you want :)
I don't think you can copy files/image in clipboard. You can do something like this:
Create a File Browser App something like (ES Explorer). You can make File Browser app using Content Providers(Not Sure) and showing the Folders/Files in List View.
Lets suppose in the app an item in ListView indicates a File/Image. On Long pressing it open a popup. with some options like Cut/Copy/Move/Delete. As you have the Absolute Path of Each file/image. You can use JAVA File Handling to:
a) Delete a File.
b) Move it from one location to another
c) Creating a Copy of File
etc..
For the details of how to copy/paste image/file in Android, read Android official document from here.
In short, copy/paste image/file follows the below steps:
As you can see, the copy/paste can only be achieved when the two applications work together. Unfortunately, most of the Android applications haven't follow this rule.
For example, the Google docs Android app, when you copy an image in Google docs, it will generate an invalid Uri. You can't imagine even google itself does not follow Android official copy/paste rule.
And I have tested many main stream editor applications, including Microsoft Word, evernote, they even don't support copy image.
Through my test, I found copy/paste image/file works on some Samsung Android phones(You can copy image from in-stock browser into the message application on Samsung Galaxy Note3). However, Samsung does not follow Android copy/paste framework. They implement the copy/paste using their own mechanism which means 3rd party applications can not access the clip data.
Hence, I think there is still a long way to go, for Android applications to follow the Android official copy/paste framework.
To talk about your requirement, I guess you want to behave as the copy data source. Although your own application supports copy, as long as copy data destination application does not follow copy/paste framework, you can't accomplish the paste action.