I'm developing an Android Application which is emoji ( emoticons)
keyboard application as a university project ..
I prepared the UI for the application by editing the softkeyboard
sample code ,provided in the samples .... What I want to do now is to
print the emoticons in the IME (the editor of the input method), once
the user click on an emoji key ..
I've tried many methods ... like using SpannableStringBuilder and
setting an Imagespan to it but the image didn't appear on the
editor....and also I tried using the following function
fromHtml(String source, Html.ImageGetter imageGetter, Html.TagHandler
tagHandler) ( note : the both methods work well in normal editText ..
but the editor of softkeboard NO)

/* using the Spannabel */
Drawable d =getResources().getDrawable(R.drawable.e4);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
SpannableString ss= new SpannableString("");
ImageSpan span= new ImageSpan(d,ImageSpan.ALIGN_BASELINE);
ss.setSpan(span,0,1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
InputConnection ic= getCurrentInputConnection();
ic.commitText(ss, 1);
--------------------------------------------------------------------------------

/* using the html.fromHtml  */
 ImageGetter imageGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable d = getResources().getDrawable(R.drawable.e11);
 d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
 return d;
           }
        };
 CharSequence cs = Html.fromHtml("<img src='" +
getResources().getDrawable(R.drawable.e11)+ "'/>",imageGetter,
null);
InputConnection ic= getCurrentInputConnection();
ic.commitText(ss, 1);

Any suggestions please ???

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to