Android Question any idea about emoticons?

coslad

Well-Known Member
Licensed User
Longtime User
I am writing a like chat app. It seems that is not possible with b4a to insert any emoticon icon in a textview. I looked for it in the forum but.... Nothing. Is it really impossible to write an app like whatsapp with b4a?
 

LucaMs

Expert
Licensed User
Longtime User
Probably the only way is to create a custom view.

Using the Canvas you can draw texts and bitmaps, then your custom view should be based on it (intercepting the key pressed and using MyCanvas.DrawText to write the correspondig character - Chr(KeyCode))
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I'm afraid the only object that returns the KeyCode is the Activity, then you should use a global variable that points to the view that has the focus (or you should use some function through reflection, if it exists)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I tried something. It works not well but it will serve you as a starting point.

There are many changes to make:

a) avoid using literal values; replace them with pseudo constants;
b) managing placeholders for icons and relative length of the text;
c) managing deleted text;
d) create a custom view, otherwise it will work only with the views stated in the project.

In short, a lot of work.

Again, it will serve you as a starting point.
 

Attachments

  • lmTextEmoticons.zip
    21 KB · Views: 406
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
We could use a map that contains the "structure" of the message; I mean that it could be contains letters, but also references to the icons.

The trouble is the repositioning of the cursor: the Touch event of the panel could be used, but I do not think that will be raised while the keyboard is on screen, then you should also create a custom keyboard.

Too complicated, but I don't have another idea!

If this can console you, here I can add this emoticon
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…