I am facing a problem here. I want to add images along with text in an EditText, but after lots of searching I reached a conclusion that I couldnt add images with text. UPTILL I got this piece of code that is supposed to be adding images to text in editText.
ImageSpan imageSpan = new ImageSpan(getResources().getDrawable(R.drawable.ic_action_emo_angry));
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append(input.getText());
String imgId = "[img=1]";
int selStart = input.getSelectionStart();
// current selection is replaceв with imageId
builder.replace(input.getSelectionStart(), input.getSelectionEnd(), imgId);
builder.setSpan(imageSpan, selStart, selStart + imgId.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
input.setText(builder);
but when I tried it, it didn't work also. so Is there a way to do it? Thanks.