Android Question Make edittext emoji for chat

Pooya1

Active Member
Licensed User
I make chat for my app
In this app,i can send picture or any file
Now i need that i allow to user for add emoji in edittext
Can i show emoji in keyboard or how do i do it?
 

Peter Simpson

Expert
Licensed User
Longtime User
Build your own emoji list of characters using Erels code example and display them to the user to select one. I would probably use a 'Sender' (for code neatness) when deciding which Emoji was selected by the user in the click event.

Using code from Erel.
B4X:
Sub Globals
    Private LblEmoji(79) As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    For i = 0 To 78
        LblEmoji(i).Initialize("LblEmoji")
        LblEmoji(i).Tag = "Emoji " & i
        LblEmoji(i).Text = UTS(0x1F600 + i)
  
        Activity.AddView(LblEmoji(i), 100%x / 2 - 10dip, i * 25dip, 20dip, 20dip)
        Log(UTS(0x1F600 + i))
    Next
End Sub

Sub UTS (codepoint As Int) As String
    Dim bc As ByteConverter
    Dim b() As Byte = bc.IntsToBytes(Array As Int(codepoint))
    Return BytesToString(b, 0, 4, "UTF32")
End Sub

Sub LblEmoji_Click
    Dim i As Label = Sender
    Log($"Tapped ${i.Tag}"$)
End Sub

The screen shot below is NOT for the code above, but it does use Erels UTS(x) code.



Enjoy...
 
Last edited:
Upvote 0

Pooya1

Active Member
Licensed User
Yes i need this code
B4X:
For i = 0 To 78
        LblEmoji(i).Initialize("LblEmoji")
        LblEmoji(i).Tag = "Emoji " & i
        LblEmoji(i).Text = UTS(0x1F600 + i)
  
        Activity.AddView(LblEmoji(i), 100%x / 2 - 10dip, i * 25dip, 20dip, 20dip)
        Log(UTS(0x1F600 + i))
    Next
Thanks
Ommm is it limit emoji?only 78 emoji?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…