I am trying to do a Notification Action (for Android 4.1+) that will copy some text to the clipboard.
I read the reference about the Copy-Paste feature and now I have this:
ClipboardManager clipboard = (ClipboardManager)
mContext.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("simple text","Hello, World!");
I don’t know how to put it into an Intent that will be put into a PendingIntent.
If you can give me some example and explain it – it will be great! I’m a new with android developing.
Thank you in advance.
Edit:
I found this: https://stackoverflow.com/a/12601766/1866009 but I don’t understand it correctly.
check this tutorial about android notifications actions :
http://www.vogella.com/articles/AndroidNotifications/article.html
when creating the pendingIntent , give it a custom intent that will be received by your broadcastReceiver (defined in your manifest, example here ) , and then do whatever you wish with it (for example copy to the clipboard) .