I have same problem while I am coding my app. Did you find a solution for this situation?
21 Ağustos 2011 Pazar 13:43:53 UTC-7 tarihinde [email protected] yazdı: > > > I'm developing an Android application .. its an 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 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) { > //int id = Integer.parseInt(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); > tv.setText(cs); > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/6f3d7051-6a27-407c-8f7c-2c13dbd86614%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

