Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy Images/files to clipboard in android? Any Alternative methods/steps to get this

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 know how can we achieve this.

Any one please help me OR give me some suggestions?

i found this link but now clue how to achieve this functionality.

like image 499
Satish Kutikuppala Avatar asked Jun 05 '15 07:06

Satish Kutikuppala


People also ask

How to copy text and images to clipboard on Android device?

If you are working on an Android device, then you can easily copy text and images to the clipboard and use them as and when necessary. Follow the steps given below to see how: 1. Firstly, open the internet browser on your device (say Google Chrome). 2. Now search for whatever image you are looking for. 3.

How do I copy and paste an image on my Android?

Open the File Manager app and allow it the necessary permission. Go to the Images folder and look for the image you want to copy. Long press the image. Tap on the copy icon at the bottom left. Your image is now copied to the clipboard. Go to the folder where you need to paste it. Tap the Paste button to paste the image.

How do I copy an image to the clipboard?

Go to the Images folder and look for the image you want to copy. Long press the image. Tap on the copy icon at the bottom left. Your image is now copied to the clipboard.

How to delete old clipboard items on Android?

Look for a clipboard icon in the top toolbar. This will open the clipboard, and you’ll see the recently copied item at the front of the list. Simply tap any of the options in the clipboard to paste it into the text field. Android does not save items to the clipboard forever. After a while, the oldest clipboard items will be deleted.


2 Answers

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:

  1. The data source(the application where you copy data from) should create a ContentProvider and generate a Uri which can be used to retrived the image/file. The Uri looks like content://[application package name]/path/to/file
  2. The data destination(the application where you copy data to) get the Uri from ClipboardManager and user ContentResolver to retrive the image/file.

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.

like image 50
cmoaciopm Avatar answered Sep 21 '22 15:09

cmoaciopm


I don't think you can copy files/image in clipboard. You can do something like this:

  1. 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.

  2. 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..

like image 33
Ashish Rathee Avatar answered Sep 18 '22 15:09

Ashish Rathee