I am currently working on a simple chat application. I want to add emoticons features in this app. I already have a function to receive string from other users. What I want is-
It can easily be implemented by using SpannableString Here is a sample implementation in code.
package com.jslan.nabin.emosample;
import android.graphics.drawable.Drawable;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ImageSpan;
import android.widget.EditText;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText textBox = (EditText) findViewById(R.id.textBox);//I have created an EditText named textBox in activity_main.xml
Drawable d;
ImageSpan span;
String abc = "some :D message :D";
SpannableString ss = new SpannableString(abc);
for(int i = 0; i