Made by FA
Made by FA

Reputation: 728

Paste the current clipboard content via code

I searched for this but haven't found any viable answer.

My current Android app copies a content into the clipboard, is there any way for the app to force pasting it (via the Android copy and paste) after a certain type?

Thank you!

Upvotes: 0

Views: 83

Answers (1)

ale.m
ale.m

Reputation: 883

How are you copying it to the Clipboard?

You can paste it by using the ClipboardManager (https://developer.android.com/reference/android/content/ClipData.html)

ClipboardManager mClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
ClipData clipData = mClipboard.getPrimaryClip();
ClipData.Item item = clipData.getItemAt(0); //first item from your clipboard.

Upvotes: 1

Related Questions