Search code examples
androidemoticons

How to handling emoticons in Android


i am working on an instant chat application in android.I have done with the basic functionality like sending messages from one mobile to another and from web application to mobile application.Now i am adding some extra feature in my app . i am adding emoticons in my app . i am using library compile 'com.rockerhieu.emojicon:library:1.3.3' to add emoticons . I am getting problems while using this library.Emoticon which i select is changed after sending.Screen shot are given for the help .

ScreenShot Image 1 Selecting emotiocons

Image 2 After being sent

Image 3

image 4

activity_chat.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FCAB26"
android:orientation="vertical"
android:weightSum="1">

<ListView
    android:id="@+id/list_view_messages"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight=".60"
    android:background="@null"
    android:divider="@null"
    android:stackFromBottom="true"
    android:transcriptMode="alwaysScroll"></ListView>


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:layout_weight=".10"
    android:orientation="horizontal"
    android:weightSum="1">

    <com.rockerhieu.emojicon.EmojiconEditText
        android:id="@+id/edtMessage"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight=".70"></com.rockerhieu.emojicon.EmojiconEditText>

    <Button
        android:id="@+id/btnSendMessage"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight=".30"
        android:gravity="center"
        android:onClick="onClick"
        android:text="Send Message" />
</LinearLayout>

<FrameLayout
    android:id="@+id/emojicons"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".30" />

ChatActivity.java

Below is the part of code that is handling emoticons:

    public class ChatActivity extends FragmentActivity implements
        EmojiconGridFragment.OnEmojiconClickedListener, EmojiconsFragment.OnEmojiconBackspaceClickedListener {

    EmojiconEditText edMessage = (EmojiconEditText) findViewById(R.id.edtMessage);
 @Override
    public void onEmojiconBackspaceClicked(View view) {
        EmojiconsFragment.backspace(edMessage);
    }

    @Override
    public void onEmojiconClicked(Emojicon emojicon) {
        EmojiconsFragment.input(edMessage, emojicon);
    }

}

Please tell me how can i handle this issue.When i am selecting an emoticon from the list of emoticons provided by the library compile 'com.rockerhieu.emojicon:library:1.3.3' ,it id getting changed in the view.What should i do to handle this issue?


Solution

  • Those are android defaults, which you see when entered, to use the emoji's like as they are, you need to create your own implementation by mapping all the png files, have a look at Madhur's example he has implemented Whatsapp(Old version Non material) like app, for beginners to learn. enter image description here