I want to get all the Clipboard Data Items on the device. By the following code, I can get only the recent Clipboard data.
myClipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
ClipData abc = myClipboard.getPrimaryClip();
ClipData.Item item = abc.getItemAt(0);
String text = item.getText().toString();
How can I get complete list of saved Clipborad Data as we see on the device?
Use getItemCount() method to obtain the number of items.
Then use the getItemAt() method to fetch the items one by one using a loop.
Example:
int n = abc.getItemCount();
for(int i=0; i < n; i++)
{
ClipData.Item item = abc.getItemAt(i);
String text = item.getText().toString();
}
This usually works well with DragEvent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With