0

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.

enter image description here

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.

enter image description here

Vasant Raval
  • 257
  • 1
  • 12
  • 31
  • I wouldn't really expect emoji art to copy and paste well. Different font sizes, different fonts with different emoji drawings, different sizes of text fields that may word wrap with different rules. Your thing with a font tag won't generally work as Android doesn't display HTML most of the time. – Gabe Sechan Jun 18 '23 at 16:57
  • but this String monospaceText = "" + meme + ""; is not actually used when setting the string to clipboard – Vasant Raval Jun 18 '23 at 18:12

0 Answers0