How to Add Smiley/Emojis in Edittext?
Any Source code is Available on Internet, if yes Please Give me Link.
Thanks in Advance.
I am using below code for add Smiley/Emojis in edittext.
ImageGetter imageGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable d = getResources().getDrawable(R.drawable.happy);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}
};
cs = Html.fromHtml("<img src='" + getResources().getDrawable(R.drawable.happy) + "'/>", imageGetter, null);
edttxtemoji.setText(cs);
Android may not support some special characters, but here is the tutorial anyways:
On a PC, I believe either Alt + 1 or Alt + 2 makes a smiley face.
This website provides an excellent tutorial for how to do alt codes, along with what alt code combination does what.
For a Mac, you can hold "Option + Command + T" down to open a list of special characters. From there, open the category "Miscellaneous." Your smiley is in there.
Is this what you are looking for? If not, just let me know :). When all else fails, you could just use an image of a smiley-face.
EDIT: I'm using a Mac. I opened TextEdit, followed my above tutorial for the Mac, generated a smiley face, cut the smiley face, and pasted it into the Java code. It worked for me. If it's not working for you, try copying this:
EditText mEditText = null;
mEditText.setText("☺");
EDIT 2: I thought Martin was looking for just a smiley, not a window of Emoji's. Currently, there is no source code to open this window - only a separate app that does this, which can be found at this link or this link.
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