webserivce messages in listview with smileys - android

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\" />");

Related

Capture part of text from image and highlight captured text

I am new to android. My challenge is to create an application which captures part of text from image and highlight captured text.
Ex:
Right now getting below result by using sample
But i need result as
highlight phone number, email and website and need to capture those fields from image. Is it possible to navigate website when user click on highlighted part of website?
Please help me. Thanks in advance.
If you are using the above library
then you will get below function in CaptureActivity
boolean handleOcrDecode(OcrResult ocrResult) {}
in this function you can filter the text that you want from overall text.
After filtering the data show custom dailog with mobile number and email.
And make it email clickable so it will redirect the user to website.

Custom rendering for text with special syntax

I have a text gathered from API and it consists of custom syntax. I display it using TextView but I need to render special part of the text and convert those text into elements. An example of a text is below.
Oh, that's great idea! Check (user: someuser)'s answer for this.
You can as well look at (ref: a forum post title) or:
(ref: another forum post)
This is a hint for you! (hint: should be displayed as a mini icon
but when clicked, a tooltip should be opened)
Here is a spoiler for you.
---- spoiler ----
some spoiler. this text should not be displayed directly but it should be
converted to a button element. When the button is clicked, this text should
be shown
---- spoiler ----
So, I need to convert (user: someuser) into a link in the view which will be shown as "someuser" but when clicked, it will open a new intent. For (ref: topic) keyword, it's the same. When I hit spoiler, I want to make it a nice button indicating that it's a spoiler and when user clicks, it will expand.
How can I parse this text and show correctly in a view? I don't have problem with parsing but my problem is displaying those elements in the view.
Methods I Tried
I tried WebView instead of TextView thinking that I can convert those into HTML/Js but the performance was terrible. Although I use RecycleView and ViewHolder, WebView is simply an overkill. I need to use some kind of a TextView but with the elements I would like to have.
I also looked at custom HTML tag handling with TextView (thinking I can convert those legacy tags into html) but I failed to see how I can insert button for spoiler tag or insert custom elements like tooltip for hint.
Thank you!

emoticons in message on 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.

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