0

I am building a messaging app in android. I need to show some smiley image when a group of specific character appeared together in a string. Like if Hello friends :p shows in textview, i like to replace :p with some image like smile.png and show this in that textview. How can i show this message with an image in a textview?

Pial Kanti
  • 1,550
  • 2
  • 13
  • 26

1 Answers1

0

You can use TextWatcher

 private TextWatcher myTW = new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }
};

and then you need to append it to your EditText Note: this is my opinion how it can be solved, maybe there are better solutions

Tano
  • 609
  • 8
  • 23