emoticons in message on Android - android

I am developing a chat application(like Simple Gtalk) for android mobiles. I am facing few issues in display emoji's/emoticons.
I need to replace the special character to a emojis image. How can i do this?
I select Image from grid.
Display corresponding special character of image selected into Edit Text along with message i typed.
When i click on send button i need to display emojis/ emotions instead of special character in the above list view where i display all the messages i receive from .NET web service. These images(emojis) are stored in drawable folder.
I get these messages from web service. But I want to know how can I find and replace the special character with a emojis image along with my text message coming from web service.

I need to replace the special character to a emojis image
You can refer to Emoji Picker.
Display corresponding special character of image selected into Edit Text along with message i typed.
This has already been answered on SO
But i want to know how can i find and replace the special character with a emojis image along with my text message coming from web service.
Check the Unicode chart.

Related

Android: How to copy one word from a block of texts to search for definition

I am developing an Android application and I have displayed a story using TextView. I want that if the user tap on a particular word, it will copy that word and send it to the dictionary within the application and search for its definition. How do I do that? How do I know what word is tapped by the user since the TextView consists of around hundred words.
In same case I used array of textViews. To make it this way you should prepare text, for example split text with " ".
The second way is to use WebView, text as html doc and some javascript.

Keylabel and keyOutputText issue

Ok I have noticed in the android softkeyboard when the user wants to send a smiley when the user prompts to a insert smiley a list of andriod smileys appear for the user to choose from Ive noticed that beside the smiley is a :) ( it varies depending on mood of smiley) Im thinking the code for that would read
<Key
android:keylabel:=":)"
android:keyOutputText="#drawable/image...." />
Im believing ( correct me if im wrong) if the uses manually types in a :) the drawable image will still appear?? Am I correct or No... Secondly If I add my own emoticons and instead of using the :) I use "*" as the Keylabel and my own image as the drawable outputtext would the user be able to use my emoticon?
Lastly, what if I only want for them to be able to select one of my emoticons to use without seeing the "*"..can I just use the android:KeyoutputText to produce the image or is the android:keylabel acting as a sort of prompt??
First, keyOutputText cannot refer to a drawable. It has to be text, a string.
Your emoticon will not appear in the text box (SMS box, or wherever you are typing) unless it is one of the built in smileys for that app. Otherwise, they'll only see something like this: "=)". To test it, try sending ":-)" in SMS (depending on your SMS app it may or may not show up as an icon) and in a Google search box. I guarantee you that you won't see an icon in the search box.
Note: you'll probably want to have defined android:keyIcon for your keys so they show the icon of the smiley rather than the output text (i.e. "=)", see android:keyOutputText).
To answer your question, if the user manually types in ":)" this is identical to the user pressing a key that has android:keyOutputText=":)".
For the second question, your "emoticon" will actually just end up being a key that sends multiple characters in a row. It saves people from having to type ':','-',')'. Instead they just hit one key and the three characters for their smiley appear.
For the last question, keyOutputText can't produce an image. Only the app that is displaying the text can convert the text to an image. In short, the keyboard is meant for sending and editing text, not icons and images.
Send me an email if you have any more questions: I've been writing a soft keyboard for Android for almost half a year now so I'm pretty familiar with how touch input works.

webserivce messages in listview with smileys

I am working on a chat application with smileys. I have a image button that shows a pop up of smileys in grid view when clicked. I can select any smiley in that and it will get displayed in Edit Text.
My problem is : Now i have smiley image and text in my edittext. when i click on send i need to display this message with smiley in listview. Is it possible to display images with text in listview where i get mesages from webservice.
List view is used here as a place to display messages from web service. How can i work further in this.
Please guide me in this issue.
Regards,
Raghav Rajagopalan
Is it possible to display images with text in listview where i get mesages from webservice.
Yes it is possible of course. If you are using some complex way to get the messages from the webservice into the adapter, you must integrate this with sending these to the adapter.
Is it possible to send images to webservice and fetch them back in my listview. I am using .Net web service. I return XML from web service as my response.
Don not do that. Put your smileys in drawable or download them only once. Use your own tags inside text for smileys. For example when string :) occurs put a smiley.
I created a Db and added 4 fields to it: ID , Position, Special Character, URL. So i was able to display the corresponding specialcharcter when clicked. When i submit how can i convert that specialcharcter into smiley image. I tried to use functions like "Contains()" and "Replace". But nothing worked when i submited the message to listview. I get the same specialcharcter and text. I don get the image instead of specialcharcter. Please guide me
I suppose you are inserting the message inside a textView. You can use to replace the occurances of the special character with "<img src=\"the source\" />"
Use this to get the image shown setText(Html.fromHtml("hi how are you <img src=\"yourimage.png\" />"));
To replace :) with <img src=\"yourimage.png\" />.. use yourString.replaceAll(":)","<img src=\"yourimage.png\" />");

smiley with text message to be displayed in list view

How can i display smiley along with text message in listview. I am developing chat screen.i type message and i need to add smileys along with text. When i press enter button i need to display text and smiley in the above list view where i display list of messages. Please guide me in this.
some thing like Gtalk chat where we type message and we have an option to select smiley. when we select smiley corresponding special charcter will be displayed. I am able to show grid with smileys and when i select smiley i am able to display specialchatcter(statically) using the position of the smiley.
how can i display these special character and smileys from database. I am i need of help in this issue. Please guide me.
Thanks.
Regards,
Raghav
you used grid view for all smiley..you refer this this link see with multiple images
Use Spannable if you want to display text and images.

How to convert special character to Image(Smiley) [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
webserivce messages in listview with smileys
I created a Db and added 4 fields to it. 1. ID , 2. Position, 3. Special Character 4. URL. So I was able to display the corresponding special character when clicked. when I submit how can I convert that special character into smiley image. I tried to use functions like "Contains()" and "Replace". But nothing worked when I submitted the message to list view.
I am listing messages in list view from web service.
I get the same special character and text. I don get the image instead of special character.
How can I convert special character into smiley image. I store all the images in drawable folder.
First Thing :Using ListAdapter you can achieve this
Refer : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html
And Second : You need to programatically decide which icon to replay with which special character.
In List Adapter you will have textview + icon.
Another method would be to use the webview. And create a html string and replace your special characters with image tags.

Categories

Resources