I'm trying to adding some image into EditText with below code as :
Bitmap myBitmap = BitmapFactory.decodeFile(APP.DIR_APP + APP.IMAGE + "/ok.png");
Drawable mDrawable = new BitmapDrawable(getResources(), myBitmap);
ImageSpan imageSpan = new ImageSpan(mDrawable);
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append(contentText.getText());
String imgId = "[img=1]";
int selStart = contentText.getSelectionStart();
builder.replace(contentText.getSelectionStart(), contentText.getSelectionEnd(), imgId);
builder.setSpan(imageSpan, selStart, selStart + imgId.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
contentText.setText(builder);
this path as APP.DIR_APP + APP.IMAGE + "/ok.png"
is correct and i check that with file.exists()
and that return true, but i don't have selected image into edittext