Avanish Singh
Avanish Singh

Reputation: 777

My Emoji Soft Keyboard is not supporting for Message EditText Field in android

My Emoji Soft Keyboard is not supporting for Message Edittext Field in android. But Other application like WhatsApp does supported. For example, In whatsapp and wechat application, TextField does support Emoji keyboard characters, but in my mobile Messaging TextField it shows ? or _ for each character I type using my Emoji Soft keyboard. enter image description here I want to integrate Emoji character support in Mobile Messaging EditText field in Android application.

If someone could please give me way to solve this problem, i would be extremely gratitude for your answer.

Upvotes: 1

Views: 1068

Answers (4)

Avanish Singh
Avanish Singh

Reputation: 777

Just set your Emoji xml code is user define like(111222) eg-

<key android:codes="111222" android:keyIcon="@drawable/smiley"/>

and then onkey() method in softkeyboard implement like this:

public void onKey(int primaryCode, int[] keyCodes){

----
----   

else if(primaryCode == 111222){
    int codeOfEmoji= 0x1F60A;
        String text = String.valueOf(Character.toChars(codeOfEmoji));
                        mComposing.append(text);
                        sss.append(text);
                        commitTyped(getCurrentInputConnection());
    }
----
----
}

Do this process do each and every Emoji Sets. this is very simple process to handle this problem.

Upvotes: 1

Sonu Kumar
Sonu Kumar

Reputation: 969

Another answere :

public void onKey(int primaryCode, int[] keyCodes) {
        if (primaryCode == -100000) {
            int unicode = 0x1F349;
            String text = String.valueOf(Character.toChars(unicode));
            mComposing.append(text);
            commitTyped(getCurrentInputConnection());
        } else if (isWordSeparator(primaryCode)) {
            if (mComposing.length() > 0) {
                commitTyped(getCurrentInputConnection());
            }
            sendKey(primaryCode);
            updateShiftKeyState(getCurrentInputEditorInfo());
        } else if (primaryCode == Keyboard.KEYCODE_DELETE) {
            handleBackspace();
        } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
            handleShift();
        } else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
            handleClose();
            return;
        } else if (primaryCode == LatinKeyboardView.KEYCODE_OPTIONS) {
            // Show a menu or somethin'
        } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE && mInputView != null) {
            Keyboard current = mInputView.getKeyboard();
            if (current == mSymbolsKeyboard || current == mSymbolsShiftedKeyboard) {
                current = mQwertyKeyboard;
            } else {
                current = mSymbolsKeyboard;
            }
            mInputView.setKeyboard(current);
            if (current == mSymbolsKeyboard) {
                current.setShifted(false);
            }
        } else {
            handleCharacter(primaryCode, keyCodes);
        }
    }

Upvotes: 1

user4239664
user4239664

Reputation:

Just try it:

int unicode = 0x1F60A;
                    String text = String.valueOf(Character.toChars(unicode));
                    //inputConnection.commitText(text,mComposing.length());
                    mComposing.append(text);
                    sss.append(text);
                    commitTyped(getCurrentInputConnection());

Upvotes: 2

Sonu Kumar
Sonu Kumar

Reputation: 969

Found a solution:

I'm my unicode I replaced 'U+' by '0x'

example: replace 'U+1F60A' by '0x1F60A'

this way I got an 'int' like :

int unicode = 0x1F60A;
String text = String.valueOf(Character.toChars(unicode));
inputConnection.commitText(text, mComposing.length());

Look my GSM message Text version android 4.2.x: enter image description here

Look my Another message Text version android 4.4.2

enter image description here

Here show another text box like this:

enter image description here

try it with http://apps.timwhitlock.info/emoji/tables/unicode

Upvotes: 1

Related Questions