I have made an app on ASCII Art. Now, I am in the process of incorporating Emoji Art into the app.
While the functionality for setting ASCII text in the clipboard works seamlessly, I have encountered some issues when attempting to do the same with emojis. Unfortunately, the text doesn't get properly set when emojis are involved.
Here is a sample of the Emoji Art I have been working on.
Initially, I created it on my mobile device and attempted to paste it into the comment section of a social media platform. As anticipated, it was added correctly without any issues.
However, when I added the same content to the string.xml file, intending to set that string to the clipboard later, it became problematic. Upon pasting it into the Instagram comment section, it got jumbled up, which was not the case when I copied and pasted the identical content directly from the Notes app on my device where I initially created it.
Now, the first example is from my app, where I copied the emoji to the clipboard and then pasted it into Instagram comments.
The second example is from the Notes app on my device, where I originally created it.
Adapter.class
holder.copyImageView.setOnClickListener(v -> {
try {
clickCounter++;
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
String monospaceText = "<font face='monospace'>" + meme + "</font>";
ClipData clip = ClipData.newPlainText("meme", meme);
if (clickCounter == 2) {
if (mInterstitialAd != null) {
mInterstitialAd.show(binding);
}
clipboard.setPrimaryClip(clip);
Toast.makeText(context, "Copied", Toast.LENGTH_SHORT).show();
} else {
clipboard.setPrimaryClip(clip);
Toast.makeText(context, "Copied", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
}
});
And here's how it appears in the TextView.