emoticon and edittext

nw11

Member
Licensed User
Longtime User
How to insert smiley/emoticon into edit text

Hii.I Now want to create a messenger something like whatsapp, but i have a problem, How to insert smiley/emoticon into edit text, because edit text is only accept string type,,can everyone help me?..

i'm interested on the same question. I'm trying to find any solution but at now nothing works on b4a. Someone in java add an html source code (with a command 'fromhtml') with the reference of the image ditectly on the edittext with a command called 'span' (but this commands are not b4a commands). Anyone can help me ?

PS: Sorry for my english
 

mc73

Well-Known Member
Licensed User
Longtime User
I think this is not possible with editText, since as you've already said it just accepts strings. In your case, and since I don't know much about special views or perhaps libraries for that puprose, I would use a webview creating some html code, containg both the text and the images lines. Just my opinion :)
 
Upvote 0

nw11

Member
Licensed User
Longtime User
Thanks for the replay .. but i'm not sure that it's not possible to do. i have attached an image of other android app that can insert emoticon in edittext .. now i'll want to know if it is a b4a limitation or there is a tip that i can use. anyone can help me ? thanks in advance !!

PS: I have found this java source code at this link but i dont know if it can be translated in b4a code : chat - display smiley in textview and edittext in android - Stack Overflow

ImageGetter imageGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable d = getResources().getDrawable(
R.drawable.happy);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}
};

cs = Html.fromHtml(
"<img src='"
+ getResources()
.getDrawable(R.drawable.happy)
+ "'/>", imageGetter, null);
System.out.println("cs is:- " + cs);
edttxtemoji.setText(cs);


ss1wa.png



PS: Sorry for my english
 
Upvote 0
Top