1

I need to get the full history of the user on Android for image attachment.

I tried that on Android 8.1.0(API27).

private Context          o_context          = null;
private ClipboardManager o_clipboardManager = null;
private ContentResolver  o_contentResolver  = null;
private ClipData         o_clipData         = null;

private void getClipboardHistory() {
    o_clipboardManager = (ClipboardManager) 
    getSystemService(Context.CLIPBOARD_SERVICE);

    o_contentResolver  = getContentResolver();
    o_clipData = o_clipboardManager.getPrimaryClip();

    for(int i = 0; i < o_clipData.getItemCount(); i++){
        ClipData.Item lo_item = o_clipData.getItemAt(i);

        String ls_text  = null;
        String ls_title = null;
        Uri    lo_uri   = lo_item.getUri();
    }
}

I wanted to bring all the clipboards. but o_clipData has only one text item in this code

Perhaps that is the last data copied.

A picture of what I want. default clipboard history

left text is clipboard and right text is removeAll

  • 4
    Read https://stackoverflow.com/a/51548708/4168607. – ADM Feb 18 '19 at 04:53
  • Check this - https://stackoverflow.com/a/19177644/7649582 – Asteroid Feb 18 '19 at 06:15
  • @ADM I read the link you gave me. I found out that o_clipData.getItemCount() is always one, so is there no way to attach a copied image from other apps? – SeongJae Lee Feb 18 '19 at 06:27
  • @Dhanshri I checked your link, but I don't want to copy and paste images from my app into my app. I'd like to paste an image copied from another app. – SeongJae Lee Feb 18 '19 at 06:34
  • 1
    @SeongJae Lee Hey, I just check this. Most of Android platforms the image copy past is not possible because original android OS does not have such a feature.Just read once this and try it,maybe it will help you - https://stackoverflow.com/a/16235154/7649582 – Asteroid Feb 18 '19 at 06:53
  • @Dhanshri Ok, I understood that we can't attach clipboard images to other ways. Thanks. – SeongJae Lee Feb 18 '19 at 07:23
  • 1
    welcome:)@SeongJae Lee – Asteroid Feb 18 '19 at 07:37

0 Answers0