androidrichtextclipboardmanager

Android: Copy formatted text from app into clipboard and paste to another app


I am trying to copy formatted (rich) text to ClipboardManager in the form of HTML tags. But, when I paste it to another app, it pastes HTML tags which is a expected behaviour.

How can I copy formatted text (with images) in ClipboardManager and when it is pasted to an app which supports rich text, it shows formatted text and when it is pasted to an app which support plain text, it shows plain text?


Solution

  •     ClipData clip = ClipData.newHtmlText("meta", content, htmlText);
    

    It can help with formatted text.