Emoji Keyboard support for EditField in android - android

My application uses Android 4.0 on Samsung Galaxy S3.
I want to integrate Emoji character support in EditText field in Android application.
Can anyone suggest me, how can I achieve it?
For example, In whatsapp and wechat application, TextField does support Emoji keyboard characters, but in my application it shows ? for each character I type using Emoji keyboard.
text_message = (EditText) findViewById(R.id.editText1);
text_view = (textView) findViewById(R.id.textView1);
btntest = (Button) findViewById(R.id.button1);
btntest.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
text_swype.setText(text_message.getText().toString());
}
});
and i also try https://github.com/IPL/iOSStyleEditText
and font of emoji from http://klncity1.wordpress.com/tag/emoji/
but not work

It depends on the font that is used for the TextView or its subclasses like EditText.
Every View can display emoji because there are hundreds of emoji included in Unicode and those have also become the default that most emoji keyboards and apps like WhatsApp use.
However, you won't see those colorful images as you see in WhatsApp, for example. This is because WhatsApp uses custom fonts/images for these emoji which replace the default appearance.
But if you add emoji to a text field in your normal "Messages" application or somewhere else, you should see the normal Android style which is monochrome emoji showing the Android robot.
Here's a list of common emoji and their Unicode codepoints:
https://github.com/delight-im/Emoji
They're all supported in Android's normal font. I guess you may have changed the font of your EditText in the layout.

You can use EmojiconTextView or EmojiconEditText from this library : https://github.com/rockerhieu/emojicon

Here is the list of available emoji Unicode
Sending content to Server you need to use org.apache.commons.lang3.escapeJava(...) and when getting data from server you need to reverse Unicode to emoticon so you have to use org.apache.commons.lang3.unescapeJava(...)

You have to use "EmojiconEditText" From the Library.
It will display Eemojies.
Use any one of these.
EmojiconTextView: a TextView which can render emojis.
EmojiconEditText: a EditText which can render emojis.
EmojiconGridFragment: a fragment contains emojis in a GridView for the user to choose.
EmojiconsFragment: a fragment contains many set of emojis for the user to choose.

Below is Util from org.apache.commons.lang3
Answer posted by #AZ_ is right but the util name has updated as below :
Send string to server as :
org.apache.commons.lang3.StringEscapeUtils.escapeJava(mEdText1.getText().toString()
Read String from server as :
org.apache.commons.lang3.StringEscapeUtils.unescapeJava(mData.get(position).getText())

Related

Is there any way to convert stylish font to normal font in Android?

In my Android app i want to search users from server this works fine when i use regular Gboard or English & Indic Languages keyboard. But when i change my phone keyboard to other stylish font keyboard like above screenshot then i can't get any data from server. Same username found when search from regular keyboard.
Is there any ways to convert stylish text to normal text in android app side?
OR
Any change need in sql query on server side for this issue?
You can convert the stylish font text to its equivalent text using the following:
Normalizer.normalize(stylishText, Normalizer.Form.NFKD)
Note:
To err on the side of caution and to remove unnecessary API calls I would suggest (in this particular case of searching) to restrict the user from entering any unwanted characters. You could specify the digits that can be inputted into the EditText like so:
android:digits="0123456789abcdefghijklmnopqrstuvwxyz "
Don't remove the space at the end so that the user can enter blank spaces

Android :prevent EditText from rendering Emoji

What I need is to stop edittext from Rendering system default Emojis
and use my own emojis with the same rendering way ( unicodes ) , so I DONT to FILTER the Text so it wont pass the text between a range so that emojis wont show up and I just don't know which method to override or remove from default EditText to stop this rendering . the casue I need to do this is that whenever I want to render my own emojis it will first be rendered to system default emojis and quickly changes the span to mine and this isn't nice
if I use filters then I wont be able to enter any emojis with Unicode so filtering by emoji Unicode range is not the ANSWER !
in EditText xlm set attribute
app:emojiCompatEnabled="false"
it will stop render emoji by AppCompat

How to use phonetic edit-text or Search-view in Android?

Like, I will write using a English keyboard but in EditText/SearchView the font will become Phonetic [bangla]. How can I achieve this ?
Example
The process is called transliteration. There are libraries available that can do that. The Google Translate library is one such example.
I'm thinking:
Enter text in your edit text.
Send it to Library.
Show a loading indicator.
Receive the transliterated response from Library.
Set it in your edit text
Hide loading indicator.

Include emoji in button string

I am trying to have a button with an emoji character within the text string for that button. I know there is a way to do this in iOS, is there a way to do this in Android?
In Android, you use Spannable to display images inline with text (which is similar to the iOS 'NSAttributedString` concept, I believe).
This should work for TextView Button and EditText and there are many references / examples available, depending on your needs.
Check out the answer over here:
how set emoji by unicode in a textview?
You have to use unicodes unlike in iOS where you can add them directly

how to replace emoji in android softkeyboard

To display the emoji button in the soft keyboard I use this in the EditText:
android:inputType="textShortMessage"
which uses the emoji icons for my device (which may be specific to my carrier/phone model).
I want to use my own set of drawables instead. Is there a way to do this without having to create a completely new soft keyboard?
No, there isn't any single line solution, maybe there is one at Lollipop as it is shipped with emoticons.
Options:
Implement a keyboard (needs a lot of effort + user to change his default keyboard)
Implement a panel/dialog that act as keyboard (needs less effort)
Use an existing library to do so a list of libraries is here but you can search for more if you want!
I was able to solve this by using the EmojiHandler from here:
To get the unicode of the emoji from textual message content:
String s = EmojiHandler.decodeJava(content);
// use decoded string to display emoji in TextView, Button, etc
textButton.setText(s);
To encode the emoji from the softkeyboard and put it into a String:
String encodedEmoji = EmojiHandler.encodeJava(msgText);

Categories

Resources